How to mentally write 6519 as a sum of at most four squares ? Answer inside

Firstly, we check if 6519 ≡ 7 (mod 8), because that tells us in advance whether three squares can possibly be enough.

Squares (mod 8) can only be 0, 1 or 4 :

  • Even numbers are 0 or 4 (mod 8)
  • Odd numbers are 1 (mod 8)

Three squares can never give 7, because a square leaves a remainder of only 0, 1 or 4 when divided by 8. So when you add three squares, you’re really adding three numbers picked from {0, 1, 4} to find the remainder. There are only 10 ways to pick them:

picks 0+0+0; sum 0; remainder (mod 8) 0

picks 0+0+1; sum 1; remainder (mod 8) 1

picks 0+0+4; sum 4; remainder (mod 8) 4

picks 0+1+1; sum 2; remainder (mod 8) 2

picks 0+1+4; sum 5; remainder (mod 8) 5

picks 0+4+4; sum 8; remainder (mod 8) 0

picks 1+1+1; sum 3; remainder (mod 8) 3

picks 1+1+4; sum 6; remainder (mod 8) 6

picks 1+4+4; sum 9; remainder (mod 8) 1

picks 4+4+4; sum 12; remainder (mod 8) 4

7 never appears in the last column. If we add any three values from {0, 1, 4} the possible results (mod 8) are 0, 1, 2, 3, 4, 5 and 6, but never 7. So three squares can’t work.

Now, we choose the first square, a². The remainder 6519 − a² must be a sum of three squares.

If is a multiple of 4, (6519 − a²) (mod 8) gives us a remainder of 7, which is doesn’t works.

If is 2 more than a multiple of 4, (6519 − a²) (mod 8) gives us a remainder of 3, which works.

If is odd, (6519 − a²) (mod 8) gives us a remainder of 6, which works.

We start near √6519 ≈ 80.7, but we skip multiples of 4, because they leave a remainder that is still 7 (mod 8).

So, a = 80 is a multiple of 4: we skip it.

We choose a = 78, because 78^2= 6084, and 6519 – 6084 give us 435 and 435 (mod 8) = 3

If we look again at the table of three picks from {0, 1, 4}, only one row gives 3 : 1 + 1 + 1

And which squares leave remainder 1? Only the odd ones, because even squares leave 0 or 4. So if 435 = b² + c² + d², then b, c and d must all be odd.

So, we have a, which is 78.

To find b, we split 435 into three odd squares. We subtract odd squares b² from the top and we check whether what’s left is a sum of two squares.

The largest odd square below 435 is 361, and 361 =19^2.

Now, 435 – 361 = 74.

Is 74 a sum of two squares ? Yes it is.

The direct way to know if is a sum of two squares is subtracting squares from 74 and see whether a square is left. The larger of the two must be at least half of 74, which is 37, so only 7 and 8 are possible:

  • 74 − 64 = 10, not a square
  • 74 − 49 = 25 = 5²

So 74 = 7² + 5² = 49 + 25

We finally write down the answer : 6519 = 78^2 + 19^2 + 7² + 5²

I was helpeb by IA. Any mistake is mine.

1 Like

Is this a series of steps to be able to express any number as a sum of at least four squares or this is specifically for 6519?

1 Like

I cannot answer with certainty because I haven’t tried with others numbers yet.

1 Like

We want to mentally write 87,431 as a sum of at most four squares.

87,431 = 295^2 + 19^2 + 6^2 + 3^2

We start looking at the last three digits (mod 8) ; so we calculate 431 (mod 8) ≡ 7.

Why the last three digits ? Because 1000 = 8 × 125, so every multiple of 1000 is divisible by 8 and has no effect on the remainder:

87,431 = 87 × 1000 + 431

Back to 431 (mod 8) ≡ 7, that means that 431 = 53 × 8 + 7

A number of the form 8k+7 can’t be written with three squares, so you need exactly four.

Then, we take a big first square, we notice that 295² = 87,025, so it sits just below the target.

87,431 − 87,025 = 406

Now, we split the remainder into three squares, be trying large squares below 406 and looking for a remainder that splits into two

406 - 20^2 = 406 – 400 = 6, which isn’t a sum of two squares

We try with 19^2.

406 - 19^2 = 406 – 361 = 45, and 45 can be split as 6² + 3².

1 Like