
Home > Numbers
Sum of four squares (Posted on 2025-04-14) |
|
There are infinitely many sets of positive integers A<B<C<D such that A^2+B^2, A^2+B^2+C^2, and A^2+B^2+C^2+D^2 are all squares. Find the value of A≤ 1500 which leads to the largest number of solutions.
A computer solution
|
| Comment 3 of 5 |
|
Algorithmic points which I hope made the program faster: (1) Once A^2 or A^2+B^2 or A^2+B^2+C^2 has been calculated once, the total is put into a list or dictionary to use as a lookup table. (2) I first found a complete answer for A^2+B^2, then searched only those (A,B) pairs combined with all possible C values. Then limited the final search to only the (A,B,C) triplets which resolved to a square when checking all D values. I thought about limiting the 2nd and 3rd searches to only those pair or triplets which had a fairly large count (I guess this would be a greedy algorithm), but ended up not doing so.
Results (I'll put code in a separate comment) I started with maximum values for A,B,C,D as 1500, 1800, 2100, 2400 (ie not very large). This found A=216 as the value with the most solutions.
I increased maximum values for A,B,C,D as 1500, 2500, 3500, 4500. This found the most values for A when all conditions were met was A=288 (I found 121 such quadruplets). Choosing larger values for maximum B,C,D might yield yet a different result for the "best A".
Here are the 121 A,B,C,D quadruplets found with A=288 [288, 330, 584, 1752], [288, 384, 476, 507], [288, 384, 476, 2145], [288, 384, 476, 4368], [288, 384, 504, 522], [288, 384, 504, 697], [288, 384, 504, 928], [288, 384, 504, 1305], [288, 384, 504, 1610], [288, 384, 504, 2030], [288, 384, 504, 2475], [288, 384, 504, 3328], [288, 384, 504, 4147], [288, 384, 550, 1752], [288, 384, 640, 840], [288, 384, 640, 1122], [288, 384, 640, 1155], [288, 384, 640, 1500], [288, 384, 640, 1920], [288, 384, 640, 2436], [288, 384, 640, 3150], [288, 384, 640, 3960], [288, 384, 693, 1124], [288, 384, 728, 1635], [288, 384, 900, 931], [288, 384, 900, 1071], [288, 384, 900, 1265], [288, 384, 900, 1360], [288, 384, 900, 1547], [288, 384, 900, 1584], [288, 384, 900, 2448], [288, 384, 900, 2501], [288, 384, 900, 2800], [288, 384, 900, 2975], [288, 384, 900, 3393], [288, 384, 900, 3757], [288, 384, 900, 4275], [288, 384, 1152, 1265], [288, 384, 1152, 1430], [288, 384, 1152, 1664], [288, 384, 1152, 1836], [288, 384, 1152, 2135], [288, 384, 1152, 2340], [288, 384, 1152, 2560], [288, 384, 1152, 2914], [288, 384, 1152, 3211], [288, 384, 1152, 3640], [288, 384, 1152, 3960], [288, 384, 1235, 3180], [288, 384, 1400, 1554], [288, 384, 1400, 2538], [288, 384, 1400, 2775], [288, 384, 1400, 3552], [288, 384, 1768, 3435], [288, 384, 1890, 2160], [288, 384, 1890, 2600], [288, 384, 1890, 4000], [288, 384, 2376, 3232], [288, 384, 2860, 3045], [288, 384, 2860, 3705], [288, 540, 759, 1080], [288, 540, 759, 1300], [288, 540, 759, 2000], [288, 540, 759, 2340], [288, 540, 759, 2728], [288, 540, 759, 3740], [288, 540, 759, 4004], [288, 540, 816, 931], [288, 540, 816, 1071], [288, 540, 816, 1265], [288, 540, 816, 1360], [288, 540, 816, 1547], [288, 540, 816, 1584], [288, 540, 816, 2448], [288, 540, 816, 2501], [288, 540, 816, 2800], [288, 540, 816, 2975], [288, 540, 816, 3393], [288, 540, 816, 3757], [288, 540, 816, 4275], [288, 540, 1309, 2244], [288, 540, 1309, 3468], [288, 540, 1680, 2384], [288, 540, 1785, 2516], [288, 540, 2565, 3516], [288, 540, 2720, 2784], [288, 616, 1056, 2355], [288, 616, 1275, 2244], [288, 616, 1275, 3468], [288, 616, 1365, 1548], [288, 616, 1365, 3660], [288, 616, 1632, 1974], [288, 616, 1632, 2415], [288, 616, 1632, 2601], [288, 616, 1632, 3315], [288, 616, 1632, 3549], [288, 616, 1632, 4455], [288, 741, 1060, 1092], [288, 741, 1060, 3180], [288, 741, 1908, 2756], [288, 741, 1908, 3960], [288, 741, 1908, 4240], [288, 840, 1184, 1554], [288, 840, 1184, 2538], [288, 840, 1184, 2775], [288, 840, 1184, 3552], [288, 840, 1225, 3816], [288, 840, 1665, 2516], [288, 1134, 1296, 2328], [288, 1134, 1560, 2160], [288, 1134, 1560, 2600], [288, 1134, 1560, 4000], [288, 1134, 2400, 3560], [288, 1134, 2808, 4056], [288, 1280, 2460, 2784], [288, 1716, 1827, 3364], [288, 1716, 2223, 3764], [288, 1716, 2320, 2739], [288, 1716, 2320, 3045], [288, 1716, 2320, 3705], [288, 1716, 3139, 4020]
|
Posted by Larry
on 2025-04-16 12:55:55 |
|
 |
Please log in:
Forums (0)
Newest Problems
Random Problem
FAQ |
About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On
Chatterbox:
|