Find the lowest number that can be represented as a sum of 2 squares of distinct integers in 12 different ways.
This confirms Dej Mar's findings. The program reports any N with 12 or more ways of achieving the result, counting differing perfect square addends as 4 ways (per assigning differing or the same signs), but equal perfect squares as just 1 way (with one positive and one negative).
N ways
325 12
425 12
625 12
650 12
725 12
845 12
850 12
925 12
1025 12
1105 16
1300 12
1325 12
1445 12
1450 12
1525 12
1625 16
1690 12
1700 12
1825 12
1850 12
1885 16
2050 12
2125 16
2210 16
2225 12
2405 16
2425 12
2465 16
2500 12
2525 12
2600 12
2650 12
2665 16
2725 12
2825 12
2873 12
DEFDBL A-Z
CLS
FOR n = 2 TO 9999
ct = 0
FOR a = 0 TO INT(SQR(n) + .5)
rest = n - a * a
IF rest > 0 THEN
b = INT(SQR(rest) + .5)
IF b * b = rest THEN
IF b > a THEN ct = ct + 4
IF b = a THEN ct = ct + 1
IF b < a THEN EXIT FOR
END IF
ELSE
EXIT FOR
END IF
NEXT
IF ct >= 12 THEN
PRINT n, ct
solCt = solCt + 1
IF solCt > 35 THEN END
END IF
NEXT
A variant of the program, requiring that the actual squares be distinct (in other words, using only non-negative integers), finds 160225 as the first one having 12 ways of doing so.
160225 12
204425 12
226525 12
292825 12
320450 12
337025 12
348725 12
359125 12
386425 12
403325 12
408850 12
416585 12
453050 12
456025 12
469625 12
491725 12
493025 12
499525 12
505325 12
531505 12
535925 12
544765 12
558025 12
574925 12
585650 12
588965 12
602225 12
612625 12
624325 12
637325 12
640900 12
644725 12
653225 12
674050 12
688025 12
690625 12
DEFDBL A-Z
CLS
FOR n = 2 TO 999999
ct = 0
FOR a = 0 TO INT(SQR(n) + .5)
rest = n - a * a
IF rest > 0 THEN
b = INT(SQR(rest) + .5)
IF b * b = rest THEN
IF b > a THEN ct = ct + 1
IF b = a THEN ct = ct + 0
IF b < a THEN EXIT FOR
END IF
ELSE
EXIT FOR
END IF
NEXT
IF ct >= 12 THEN
PRINT n, ct
solCt = solCt + 1
IF solCt > 35 THEN END
END IF
NEXT
The actual ways, using squares of non-negative integers, for forming 160225 are:
a b a^2 b^2
15 400 225 160000
32 399 1024 159201
76 393 5776 154449
81 392 6561 153664
113 384 12769 147456
140 375 19600 140625
175 360 30625 129600
183 356 33489 126736
216 337 46656 113569
228 329 51984 108241
252 311 63504 96721
265 300 70225 90000
|
Posted by Charlie
on 2011-09-08 11:59:17 |