>>> def f(n):
... return {
... (a < b and (a, b)) or (b, a)
... for a in range(1, n)
... for b in range(1, n)
... if n == a * a + b * b
... }
...
>>> for n in range(1, 200 + 1):
... s = f(n)
... if s:
... print(n, '->', s)
...
2 -> {(1, 1)}
5 -> {(1, 2)}
8 -> {(2, 2)}
10 -> {(1, 3)}
13 -> {(2, 3)}
17 -> {(1, 4)}
18 -> {(3, 3)}
20 -> {(2, 4)}
25 -> {(3, 4)}
26 -> {(1, 5)}
29 -> {(2, 5)}
32 -> {(4, 4)}
34 -> {(3, 5)}
37 -> {(1, 6)}
40 -> {(2, 6)}
41 -> {(4, 5)}
45 -> {(3, 6)}
50 -> {(5, 5), (1, 7)}
52 -> {(4, 6)}
53 -> {(2, 7)}
58 -> {(3, 7)}
61 -> {(5, 6)}
65 -> {(1, 8), (4, 7)}
68 -> {(2, 8)}
72 -> {(6, 6)}
73 -> {(3, 8)}
74 -> {(5, 7)}
80 -> {(4, 8)}
82 -> {(1, 9)}
85 -> {(6, 7), (2, 9)}
89 -> {(5, 8)}
90 -> {(3, 9)}
97 -> {(4, 9)}
98 -> {(7, 7)}
100 -> {(6, 8)}
101 -> {(1, 10)}
104 -> {(2, 10)}
106 -> {(5, 9)}
109 -> {(3, 10)}
113 -> {(7, 8)}
116 -> {(4, 10)}
117 -> {(6, 9)}
122 -> {(1, 11)}
125 -> {(5, 10), (2, 11)}
128 -> {(8, 8)}
130 -> {(3, 11), (7, 9)}
136 -> {(6, 10)}
137 -> {(4, 11)}
145 -> {(8, 9), (1, 12)}
146 -> {(5, 11)}
148 -> {(2, 12)}
149 -> {(7, 10)}
153 -> {(3, 12)}
157 -> {(6, 11)}
160 -> {(4, 12)}
162 -> {(9, 9)}
164 -> {(8, 10)}
169 -> {(5, 12)}
170 -> {(1, 13), (7, 11)}
173 -> {(2, 13)}
178 -> {(3, 13)}
180 -> {(6, 12)}
181 -> {(9, 10)}
185 -> {(4, 13), (8, 11)}
193 -> {(7, 12)}
194 -> {(5, 13)}
197 -> {(1, 14)}
200 -> {(2, 14), (10, 10)}
>>>