All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Square challenge (Posted on 2004-01-20)
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?

 See The Solution Submitted by SilverKnight Rating: 2.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: solution and bonus answer Comment 16 of 16 |

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  2565            1  64         16  4985            4  81         36  49125           4  121        25  100130           9  121        49  81145           1  144        64  81170           1  169        49  121185           16  169       64  121200           4  196        100  100205           9  196        36  169221           25  196       100  121250           25  225       81  169260           4  256        64  196265           9  256        121  144290           1  289        121  169305           16  289       49  256325           1  324        36  289       100  225338           49  289       169  169340           16  324       144  196365           4  361        169  196370           9  361        81  289377           16  361       121  256410           49  361       121  289425           25  400       64  361       169  256442           1  441        81  361445           4  441        121  324450           9  441        225  225481           81  400       225  256485           1  484        196  289493           9  484        169  324500           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 IFNEXT`

 Posted by Charlie on 2009-01-26 18:12:02

 Search: Search body:
Forums (0)