---
# System prepended metadata

title: 1925. Count Square Sum Triples
tags: [Leetcode, Easy, Math]

---

# 1925. Count Square Sum Triples
###### tags: `Leetcode` `Math` `Easy`
Link: https://leetcode.com/problems/count-square-sum-triples/description/
## Code
```python=
class Solution:
    def countTriples(self, n: int) -> int:
        ans = 0
        for i in range(1, n+1):
            for j in range(i, n+1):
                curr = i*i+j*j
                if curr<=n*n and int(math.sqrt(curr))*int(math.sqrt(curr))==curr:
                    if i != j:
                        ans += 2
        return ans
```