Find the smallest number that can be expressed as the sum of two (nonzero) perfect squares in two different ways.
_____________
And what if the two perfect squares must be nonzero, positive, and different?
(In reply to
solution and bonus answer by Dej Mar)
Actually:
The smallest number that can be expressed as the sum of two (non-zero) perfect squares in three different ways is
325: 12 + 182, 62 + 172 and 102 + 152.
50 1 49 25 25
65 1 64 16 49
85 4 81 36 49
125 4 121 25 100
130 9 121 49 81
145 1 144 64 81
170 1 169 49 121
185 16 169 64 121
200 4 196 100 100
205 9 196 36 169
221 25 196 100 121
250 25 225 81 169
260 4 256 64 196
265 9 256 121 144
290 1 289 121 169
305 16 289 49 256
325 1 324 36 289 100 225
338 49 289 169 169
340 16 324 144 196
365 4 361 169 196
370 9 361 81 289
377 16 361 121 256
410 49 361 121 289
425 25 400 64 361 169 256
442 1 441 81 361
445 4 441 121 324
450 9 441 225 225
481 81 400 225 256
485 1 484 196 289
493 9 484 169 324
500 16 484 100 400
FOR n = 1 TO 500
ways = 0
FOR i = 1 TO SQR(n / 2) + 1
part1 = i * i
part2 = n - part1
IF part2 >= part1 THEN
sr = INT(SQR(part2) + .5)
IF sr * sr = part2 THEN
ways = ways + 1
hold1(ways) = part1
hold2(ways) = part2
END IF
END IF
NEXT
IF ways > 1 THEN
PRINT n,
FOR i = 1 TO ways
PRINT hold1(i); hold2(i),
NEXT
PRINT
END IF
NEXT
|
Posted by Charlie
on 2009-01-26 18:12:02 |