Show the Lagrange Four Square Theorem for
37
For any natural number (p), we write as
p = a2 + b2 + c2 + d2
Floor(√37) = Floor(6.0827625302982)
Floor(6.0827625302982) = 6
This is called max_a
Find the first value of a such that
a2 ≥ n/4
Start with min_a = 0 and increase by 1
Continue until we reach or breach n/4 → 37/4 = 9.25
When min_a = 4, then it is a2 = 16 ≥ 9.25, so min_a = 4
(0, 6)
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 02)
max_b = Floor(√37 - 0)
max_b = Floor(√37)
max_b = Floor(6.0827625302982)
max_b = 6
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 02)/3 = 12.333333333333
When min_b = 4, then it is b2 = 16 ≥ 12.333333333333, so min_b = 4
(4, 6)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 02 - 42)
max_c = Floor(√37 - 0 - 16)
max_c = Floor(√21)
max_c = Floor(4.5825756949558)
max_c = 4
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 02 - 42)/2 = 10.5
When min_c = 4, then it is c2 = 16 ≥ 10.5, so min_c = 4
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 02 - 42 - 42
max_d = √37 - 0 - 16 - 16
max_d = √5
max_d = 2.2360679774998
Since max_d = 2.2360679774998 is not an integer, this is not a solution
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 02 - 52)
max_c = Floor(√37 - 0 - 25)
max_c = Floor(√12)
max_c = Floor(3.4641016151378)
max_c = 3
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 02 - 52)/2 = 6
When min_c = 3, then it is c2 = 9 ≥ 6, so min_c = 3
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 02 - 52 - 32
max_d = √37 - 0 - 25 - 9
max_d = √3
max_d = 1.7320508075689
Since max_d = 1.7320508075689 is not an integer, this is not a solution
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 02 - 62)
max_c = Floor(√37 - 0 - 36)
max_c = Floor(√1)
max_c = Floor(1)
max_c = 1
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 02 - 62)/2 = 0.5
When min_c = 0, then it is c2 = 1 ≥ 0.5, so min_c = 0
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 02 - 62 - 02
max_d = √37 - 0 - 36 - 0
max_d = √1
max_d = 1
Since max_d = 1, then (a, b, c, d) = (0, 6, 0, 1) is an integer solution proven below
02 + 62 + 02 + 12 → 0 + 36 + 0 + 1 = 37
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 02 - 62 - 12
max_d = √37 - 0 - 36 - 1
max_d = √0
max_d = 0
Since max_d = 0, then (a, b, c, d) = (0, 6, 1, 0) is an integer solution proven below
02 + 62 + 12 + 02 → 0 + 36 + 1 + 0 = 37
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 12)
max_b = Floor(√37 - 1)
max_b = Floor(√36)
max_b = Floor(6)
max_b = 6
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 12)/3 = 12
When min_b = 4, then it is b2 = 16 ≥ 12, so min_b = 4
(4, 6)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 12 - 42)
max_c = Floor(√37 - 1 - 16)
max_c = Floor(√20)
max_c = Floor(4.4721359549996)
max_c = 4
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 12 - 42)/2 = 10
When min_c = 4, then it is c2 = 16 ≥ 10, so min_c = 4
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 12 - 42 - 42
max_d = √37 - 1 - 16 - 16
max_d = √4
max_d = 2
Since max_d = 2, then (a, b, c, d) = (1, 4, 4, 2) is an integer solution proven below
12 + 42 + 42 + 22 → 1 + 16 + 16 + 4 = 37
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 12 - 52)
max_c = Floor(√37 - 1 - 25)
max_c = Floor(√11)
max_c = Floor(3.3166247903554)
max_c = 3
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 12 - 52)/2 = 5.5
When min_c = 3, then it is c2 = 9 ≥ 5.5, so min_c = 3
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 12 - 52 - 32
max_d = √37 - 1 - 25 - 9
max_d = √2
max_d = 1.4142135623731
Since max_d = 1.4142135623731 is not an integer, this is not a solution
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 12 - 62)
max_c = Floor(√37 - 1 - 36)
max_c = Floor(√0)
max_c = Floor(0)
max_c = 0
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 12 - 62)/2 = 0
When min_c = 0, then it is c2 = 1 ≥ 0, so min_c = 0
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 12 - 62 - 02
max_d = √37 - 1 - 36 - 0
max_d = √0
max_d = 0
Since max_d = 0, then (a, b, c, d) = (1, 6, 0, 0) is an integer solution proven below
12 + 62 + 02 + 02 → 1 + 36 + 0 + 0 = 37
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 22)
max_b = Floor(√37 - 4)
max_b = Floor(√33)
max_b = Floor(5.744562646538)
max_b = 5
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 22)/3 = 11
When min_b = 4, then it is b2 = 16 ≥ 11, so min_b = 4
(4, 5)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 22 - 42)
max_c = Floor(√37 - 4 - 16)
max_c = Floor(√17)
max_c = Floor(4.1231056256177)
max_c = 4
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 22 - 42)/2 = 8.5
When min_c = 3, then it is c2 = 9 ≥ 8.5, so min_c = 3
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 22 - 42 - 32
max_d = √37 - 4 - 16 - 9
max_d = √8
max_d = 2.8284271247462
Since max_d = 2.8284271247462 is not an integer, this is not a solution
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 22 - 42 - 42
max_d = √37 - 4 - 16 - 16
max_d = √1
max_d = 1
Since max_d = 1, then (a, b, c, d) = (2, 4, 4, 1) is an integer solution proven below
22 + 42 + 42 + 12 → 4 + 16 + 16 + 1 = 37
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 22 - 52)
max_c = Floor(√37 - 4 - 25)
max_c = Floor(√8)
max_c = Floor(2.8284271247462)
max_c = 2
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 22 - 52)/2 = 4
When min_c = 2, then it is c2 = 4 ≥ 4, so min_c = 2
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 22 - 52 - 22
max_d = √37 - 4 - 25 - 4
max_d = √4
max_d = 2
Since max_d = 2, then (a, b, c, d) = (2, 5, 2, 2) is an integer solution proven below
22 + 52 + 22 + 22 → 4 + 25 + 4 + 4 = 37
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 32)
max_b = Floor(√37 - 9)
max_b = Floor(√28)
max_b = Floor(5.2915026221292)
max_b = 5
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 32)/3 = 9.3333333333333
When min_b = 4, then it is b2 = 16 ≥ 9.3333333333333, so min_b = 4
(4, 5)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 32 - 42)
max_c = Floor(√37 - 9 - 16)
max_c = Floor(√12)
max_c = Floor(3.4641016151378)
max_c = 3
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 32 - 42)/2 = 6
When min_c = 3, then it is c2 = 9 ≥ 6, so min_c = 3
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 32 - 42 - 32
max_d = √37 - 9 - 16 - 9
max_d = √3
max_d = 1.7320508075689
Since max_d = 1.7320508075689 is not an integer, this is not a solution
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 32 - 52)
max_c = Floor(√37 - 9 - 25)
max_c = Floor(√3)
max_c = Floor(1.7320508075689)
max_c = 1
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 32 - 52)/2 = 1.5
When min_c = 2, then it is c2 = 4 ≥ 1.5, so min_c = 2
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 42)
max_b = Floor(√37 - 16)
max_b = Floor(√21)
max_b = Floor(4.5825756949558)
max_b = 4
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 42)/3 = 7
When min_b = 3, then it is b2 = 9 ≥ 7, so min_b = 3
(3, 4)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 42 - 32)
max_c = Floor(√37 - 16 - 9)
max_c = Floor(√12)
max_c = Floor(3.4641016151378)
max_c = 3
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 42 - 32)/2 = 6
When min_c = 3, then it is c2 = 9 ≥ 6, so min_c = 3
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 42 - 32 - 32
max_d = √37 - 16 - 9 - 9
max_d = √3
max_d = 1.7320508075689
Since max_d = 1.7320508075689 is not an integer, this is not a solution
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 42 - 42)
max_c = Floor(√37 - 16 - 16)
max_c = Floor(√5)
max_c = Floor(2.2360679774998)
max_c = 2
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 42 - 42)/2 = 2.5
When min_c = 2, then it is c2 = 4 ≥ 2.5, so min_c = 2
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 42 - 42 - 22
max_d = √37 - 16 - 16 - 4
max_d = √1
max_d = 1
Since max_d = 1, then (a, b, c, d) = (4, 4, 2, 1) is an integer solution proven below
42 + 42 + 22 + 12 → 16 + 16 + 4 + 1 = 37
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 52)
max_b = Floor(√37 - 25)
max_b = Floor(√12)
max_b = Floor(3.4641016151378)
max_b = 3
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 52)/3 = 4
When min_b = 2, then it is b2 = 4 ≥ 4, so min_b = 2
(2, 3)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 52 - 22)
max_c = Floor(√37 - 25 - 4)
max_c = Floor(√8)
max_c = Floor(2.8284271247462)
max_c = 2
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 52 - 22)/2 = 4
When min_c = 2, then it is c2 = 4 ≥ 4, so min_c = 2
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 52 - 22 - 22
max_d = √37 - 25 - 4 - 4
max_d = √4
max_d = 2
Since max_d = 2, then (a, b, c, d) = (5, 2, 2, 2) is an integer solution proven below
52 + 22 + 22 + 22 → 25 + 4 + 4 + 4 = 37
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 52 - 32)
max_c = Floor(√37 - 25 - 9)
max_c = Floor(√3)
max_c = Floor(1.7320508075689)
max_c = 1
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 52 - 32)/2 = 1.5
When min_c = 2, then it is c2 = 4 ≥ 1.5, so min_c = 2
Find max_b which is Floor(√n - a2)
max_b = Floor(√37 - 62)
max_b = Floor(√37 - 36)
max_b = Floor(√1)
max_b = Floor(1)
max_b = 1
Find b such that b2 ≥ (n - a2)/3
Call it min_b
Start with min_b = 0 and increase by 1
Go until (n - a2)/3 → (37 - 62)/3 = 0.33333333333333
When min_b = 0, then it is b2 = 1 ≥ 0.33333333333333, so min_b = 0
(0, 1)
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 62 - 02)
max_c = Floor(√37 - 36 - 0)
max_c = Floor(√1)
max_c = Floor(1)
max_c = 1
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 62 - 02)/2 = 0.5
When min_c = 0, then it is c2 = 1 ≥ 0.5, so min_c = 0
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 62 - 02 - 02
max_d = √37 - 36 - 0 - 0
max_d = √1
max_d = 1
Since max_d = 1, then (a, b, c, d) = (6, 0, 0, 1) is an integer solution proven below
62 + 02 + 02 + 12 → 36 + 0 + 0 + 1 = 37
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 62 - 02 - 12
max_d = √37 - 36 - 0 - 1
max_d = √0
max_d = 0
Since max_d = 0, then (a, b, c, d) = (6, 0, 1, 0) is an integer solution proven below
62 + 02 + 12 + 02 → 36 + 0 + 1 + 0 = 37
Determine max_c =Floor(√n - a2 - b2)
max_c = Floor(√37 - 62 - 12)
max_c = Floor(√37 - 36 - 1)
max_c = Floor(√0)
max_c = Floor(0)
max_c = 0
Call it min_b
Start with min_c = 0 and increase by 1
Go until (n - a2 - b2 )/2 → (37 - 62 - 12)/2 = 0
When min_c = 0, then it is c2 = 1 ≥ 0, so min_c = 0
See if d is an integer solution which is √n - a2 - b2
max_d = √37 - 62 - 12 - 02
max_d = √37 - 36 - 1 - 0
max_d = √0
max_d = 0
Since max_d = 0, then (a, b, c, d) = (6, 1, 0, 0) is an integer solution proven below
62 + 12 + 02 + 02 → 36 + 1 + 0 + 0 = 37