Consecutive Perfect Squares

365 365 can be written as a sum of 2 2 consecutive perfect squares and also 3 3 consecutive non-zero perfect squares: 365 = 1 4 2 + 1 3 2 = 1 2 2 + 1 1 2 + 1 0 2 365=14^2+13^2=12^2+11^2+10^2

What is the next number with this property?


The answer is 35645.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Michael Tong
Jan 5, 2014

Our solution will be of the form

n 2 + ( n + 1 ) 2 + ( n + 2 ) 2 = ( n + a ) 2 + ( n + a + 1 ) 2 n^2 + (n+1)^2 + (n+2)^2 = (n+a)^2 + (n+a+1)^2 , where a > 2 a > 2 .

Expanded, this equals n 2 + ( 4 4 a ) n + ( 4 2 a 2 a 2 ) n^2 + (4 - 4a)n + (4 - 2a - 2a^2) , which is quadratic in n n . Since we require n n to be an integer, it only makes sense to put this into the quadratic formula and find when our discriminant is equal to 0 0 .

n = ( 4 4 a ) ± ( 4 4 a ) 2 4 ( 4 2 a 2 a 2 ) 2 n = \frac{-(4-4a) \pm \sqrt{(4-4a)^2 - 4(4 - 2a - 2a^2)}}{2}

Expanded and reduced, we come to

n = 2 a 2 ± 6 ( a 1 ) ( a ) n = 2a - 2 \pm \sqrt{6(a-1)(a)}

Thus, 6 ( a 1 ) ( a ) 6(a-1)(a) is a perfect square.

When a = 3 a = 3 , we have the condition given in the premise of the challenge.

Since g c d ( a 1 , a ) = 1 gcd(a-1, a) = 1 , it must be that one of the factors is equal to 6 m 2 6 * m^2 and the other is equal to n 2 n^2 .

If m = 1 m = 1 , then the other number is 5 5 or 7 7 , so that doesn't work. Trying m = 2 m = 2 , we find a solution in a = 25 a = 25 .

Going back to our original equation of n 2 + ( n + 1 ) 2 + ( n + 2 ) 2 = ( n + a ) 2 + ( n + a + 1 ) 2 n^2 + (n+1)^2 + (n+2)^2 = (n+a)^2 + (n+a+1)^2 , we substitute a = 25 a = 25 and expand to get n 2 96 n 1296 = ( n 108 ) ( n + 12 ) = 0 n^2 - 96n - 1296 = (n - 108)(n + 12) = 0 , thus n = 108 n = 108 .

Our desired number is 13 3 2 + 13 4 2 = 35645 133^2 + 134^2 = 35645 .

You said:

" it must be that one of the factors is equal to 6 × m 2 6 \times m^2 "

Can't one of them be 3 × m 2 3 \times m^2 and the other one 2 × n 2 2 \times n^2

Pouya Hamadanian - 7 years, 5 months ago

Log in to reply

You're right.

Consider m m odd. Then, 3 m 2 3 ( m o d 4 ) 3m^2 \equiv 3 \pmod 4 . Then either 2 n 2 = 3 m 2 + 1 2n^2 = 3m^2 + 1 or 2 n 2 + 1 = 3 m 2 2n^2 + 1 = 3m^2 , with n n even and odd, respectively.

In the first case, we get n = 3 m 2 + 1 2 n = \sqrt{\frac{3m^2 + 1}{2}} . From this we get n = 2 , 14 , 38 , 74 , . . . n = \sqrt{2}, \sqrt{14}, \sqrt{38}, \sqrt{74}, ... and so n = 2 + 6 t ( t 1 ) = 6 t 2 6 t + 2 n = \sqrt{2 + 6t(t-1)} = \sqrt{6t^2 - 6t + 2} . This requires 3 t 2 3 t + 1 = 2 x 2 3t^2 - 3t + 1 = 2x^2 , but clearly it is odd t \forall t . ( t t is just some number I picked from the positive integers to make this explanation easier)

In the second case, we get n = 3 m 2 1 2 n = \sqrt{\frac{3m^2 - 1}{2}} and so n = 6 t ( t 1 ) + 1 = 6 t 2 6 t + 1 n = \sqrt{6t(t-1) + 1} = \sqrt{6t^2 - 6t + 1} . We get an answer in n = 11 , m = 9 , a = 594 n = 11, m = 9, a = 594 . In particular, the solutions are described by http://www.wolframalpha.com/input/?i=1%2F12+%286%2B3+%285-2+sqrt%286%29%29%5Ek%2Bsqrt%286%29+%285-2+sqrt%286%29%29%5Ek%2B3+%285%2B2+sqrt%286%29%29%5Ek-sqrt%286%29+%285%2B2+sqrt%286%29%29%5Ek%29 and http://www.wolframalpha.com/input/?i=1%2F12+%286-3+%285-2+sqrt%286%29%29%5Ek-sqrt%286%29+%285-2+sqrt%286%29%29%5Ek-3+%285%2B2+sqrt%286%29%29%5Ek%2Bsqrt%286%29+%285%2B2+sqrt%286%29%29%5Ek%29

Consider m m even. Then, 3 m 2 0 ( m o d 4 ) 3m^2 \equiv 0 \pmod 4 . But, 2 m 2 0 , 2 ( m o d 4 ) 2m^2 \equiv 0,2 \pmod 4 , so this is impossible (since they are separated each by 1).

So yes, you're right.

Michael Tong - 7 years, 5 months ago

Nice solution! However, there are some typos/mistakes. You mentioned the discriminant being equal to 0, when the discriminant should actually be equal to a perfect square. Also, you said that one of the factors is equal to 6 m 2 6 * m^2 , and that the other is equal to n 2 n^2 . To avoid confusion, something like x 2 x^2 should be used instead of n 2 n^2 .

On a complete side note, I found that using n n as the middle number instead of the first number makes the computation a little easier.

Alexander Xue - 7 years, 5 months ago

it is Wrong.the answer is 1460.

amar datta - 7 years, 3 months ago

Log in to reply

Justification?

Rishik Jain - 5 years, 6 months ago

Note that 2 6 2 + 2 7 2 = 1405 < 1460 < 1513 = 2 7 2 + 2 8 2 26^2+27^2 = 1405 < 1460 < 1513 = 27^2+28^2 Hence is not the sum of 2 consecutive squares.

Also note that 2 1 2 + 2 2 2 + 2 3 2 = 1454 < 1460 < 1589 = 2 2 2 + 2 3 2 + 2 4 2 21^2+22^2+23^2 = 1454 < 1460 < 1589 = 22^2+23^2+24^2 Hence is not the sum of 3 consecutive squares.

Further checks can be done to show that 1460 is not the sum of an number of consecutive squares.

Alex Burgess - 2 years, 3 months ago

In fact, if a = 3 × m 2 a=3\times{m^2} or a = 3 × m 2 + 1 a=3\times{m^2}+1 , it is very difficult to find the solution. I have checked till m = 8 m=8 and i haven't found any solution. Can you tell me what value of m m will give the solution. I don't know how did you get the right answer with a wrong assumption.
OR
I am doing a very silly mistake for which I apologize in advance. But please clarify.

Mridul Sachdeva - 7 years, 2 months ago

What if sqrt[6a(a-1)]=594 when a=243? Then none of 243 or 242 is a multiple of 6

Xu Zachary - 1 year, 6 months ago
Jan J.
Jan 5, 2014

We wish to find x , y , z N x,y,z \in \mathbb{N} such that x = y 2 + ( y + 1 ) 2 = ( z 1 ) 2 + z 2 + ( z + 1 ) 2 x = y^2 + (y + 1)^2 = (z - 1)^2 + z^2 + (z + 1)^2 Rewrite the second equality as ( 2 y + 1 ) 2 6 z 2 = 3 (2y + 1)^2 - 6z^2 = 3 This is generalized Pell's equation that can be solved as follows, note the fundamental solution ( 2 y + 1 , z ) = ( 3 , 1 ) (2y + 1,z) = (3,1) and consider the related Pell's equation a 2 6 b 2 = 1 a^2 - 6b^2 = 1 with fundamental solution ( 5 , 2 ) (5,2) . Note that norm N N in Z [ 6 ] \mathbb{Z}\left[\sqrt{6}\right] is multiplicative, hence N ( ( 5 + 2 6 ) n ( 3 + 6 ) ) = 3 N\Big(\left(5 + 2\sqrt{6}\right)^n\cdot \left(3 + \sqrt{6}\right)\Big) = 3 That means 2 y + 1 + z 6 = ( 5 + 2 6 ) n ( 3 + 6 ) 2y + 1 + z\sqrt{6} = \left(5 + 2\sqrt{6}\right)^n\cdot \left(3 + \sqrt{6}\right) Plugging in all n N { 0 } n \in \mathbb{N} \cup \{0\} generates infinite family of solutions (I think it's been proven that it also generates all solutions, but I am not sure), but we only care about the first few solutions, so we get ( 2 y + 1 , z ) { ( 3 , 1 ) , ( 27 , 11 ) , ( 267 , 109 ) , } (2y + 1,z) \in \{ (3,1), (27,11), (267,109),\dots\} The solution ( 27 , 11 ) (27,11) corresponds to x = 365 x = 365 , hence consider the solution ( 267 , 109 ) (267,109) , which gives us x = 35645 = 13 3 2 + 13 4 2 = 10 8 2 + 10 9 2 + 11 0 2 x = 35645 = 133^2 + 134^2 = 108^2 + 109^2 + 110^2 and the answer is 645 \boxed{645} .

Holy shit!!!

Ariijit Dey - 4 years ago

Dude find the solutions for x2-7y2=5 using your method

Ariijit Dey - 4 years ago
K T
Sep 1, 2019

We make two observations:

Modulo 3: the sum of three consecutive squares, is always 2, and the only solution for the sum of two consecutive squares to be 2 is when they are equivalent to 1^2 and 2^2 Modulo 2: the sum of two consecutive squares is always odd, so the middle one of the triple must be odd.

So any solution can be written with integers a and b, in the form

( 2 a ) 2 + ( 2 a + 1 ) 2 + ( 2 a + 2 ) 2 = ( 3 b + 1 ) 2 + ( 3 b + 2 ) 2 (2a)^2+(2a+1)^2+(2a+2)^2= (3b+1)^2+(3b+2)^2

This equation is equivalent to 2 a ( a + 1 ) = 3 b ( b + 1 ) 2a(a+1)=3b(b+1) The left hand side of his expression is divisible by 4, while the right hand side is divisible by 3, so a { 0 , 2 } ( m o d 3 ) and b { 0 , 3 } ( m o d 4 ) a \in \{0,2\} \pmod 3 \text{ and } b \in \{0,3\} \pmod 4

Furthermore, (mod 5) the left hand side can only take values 0, 2 or 4 while the right hand side only takes the values 0, 1 or 3. They can only be equal if the expression is a multiple of 5. Hence a , b { 0 , 4 } ( m o d 5 ) a,b \in\{0,4\} \pmod 5

Combined a { 0 , 5 , 9 , 14 } ( m o d 15 ) a \in \{0,5,9,14\} \pmod {15} b { 0 , 4 , 15 , 19 } ( m o d 20 ) b \in \{0,4,15,19\} \pmod {20}

Also, writing 2 a 2 + 2 a 3 b ( b + 1 ) = 0 2a^2+2a-3b(b+1)=0 we have a = 2 ± 4 + 24 b ( b 1 ) 4 a=\frac{-2 \pm \sqrt{4+24b(b-1)}}{4} or simpler a = 1 + 6 b ( b + 1 ) 1 2 a=\frac{\sqrt{1+6b(b+1)}-1}{2} , so 6 b ( b + 1 ) + 1 must be an (odd) square 6b(b+1)+1\text { must be an (odd) square}

Time to try a few values:

b = 0 , a = 0 : 1 2 + 2 2 = 0 2 + 1 2 + 2 2 b=0, a=0: 1^2+2^2=0^2+1^2+2^2 . Correct, but uninteresting and too small.

b = 4 : 6 4 ( 4 + 1 ) + 1 = 121 = 1 1 2 , a = 5 , n = 365 b=4: 6 \cdot 4 \cdot (4+1)+1=121=11^2, a=5, n=365 .

b = 15 : 1441 b=15: 1441 is not a square, so no integer value for a satisfies this.

Also for b { 19 , 20 , 24 , 35 , 39 , 40 } b \in \{19, 20, 24, 35, 39, 40\} , 6 b ( b + 1 ) + 1 6b(b+1)+1 is not a square.

But for b = 44 b=44 it is: b = 44 , 6 44 ( 44 + 1 ) + 1 = 11881 = 10 9 2 b=44, 6 \cdot 44 \cdot (44+1)+1=11881=109^2 bingo! a = 54 , 2 a = 108 , 3 b + 1 = 133 a=54, 2a=108, 3b +1=133 and 10 8 2 + 10 9 2 + 11 0 2 = 13 3 2 + 13 4 2 = 35645 108^2+109^2+110^2=133^2+134^2=\boxed{35645} .

Pebrudal Zanu
Jan 5, 2014

Let m , n , m < n m,n, m<n such that:

m 2 + ( m + 1 ) 2 + ( m + 2 ) 2 = ( n + 1 ) 2 + ( n + 2 ) 2 m^2+(m+1)^2+(m+2)^2=(n+1)^2+(n+2)^2

We get this equation:

3 m 2 + 6 m = 2 n 2 + 6 n 3m^2+6m=2n^2+6n ,

From this equation m m must be even.

We have condition

n 0 ( m o d 6 ) n \equiv 0 \pmod{6} ,

Check this condition , the first numbe after n = 12 n=12 satisfy this condition is n = 132 n=132 ,

where m = 108 m=108

Hence, the last three digit for next number 13 3 2 + 13 4 2 645 ( m o d 1000 ) 133^2+134^2 \equiv \fbox{645} \pmod{1000}

Stop using computers to brute force the answer. As brilliant says, "If you need the assistance of a computer to brute force the answer, you are just not looking at the elegant side of the problem".

Keshav Kumar - 7 years, 5 months ago

We need the entire number and not the last 3 digits. Do you have any method for finding other digits. Its annoying as the number can be very large.😁😁😁😁😁

Ariijit Dey - 4 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...