A square triple (a,b,c)(a, b, c)(a,b,c) is a triple of positive integers satisfying a2+b2=c2a^2 + b^2 = c^2a2+b2=c2.
Given an integer n, return the total number of square triples such that 1≤a,b,c≤n1 \le a, b, c \le n1≤a,b,c≤n.
n
Constraints:
1≤n≤2501 \le n \le 2501≤n≤250
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Count Square Sum Triples
For the input n = 11, how many square triples are counted when (a,b)(a,b)(a,b) order matters?
n = 11
222
888
444
666
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Implement your solution in the following coding playground.