Hip to be squares

What is the smallest positive integer n n such that k = 1 n k 2 \displaystyle\sum_{k=1}^{n} k^{2} is divisible by 1000 1000 ?


The answer is 624.

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.

3 solutions

We are looking for the least positive integer n n such that n ( n + 1 ) ( 2 n + 1 ) 6 \frac{n(n + 1)(2n + 1)}{6} is divisible by 1000 1000 , i.e., such that n ( n + 1 ) ( 2 n + 1 ) n(n + 1)(2n + 1) is divisible by 6000. 6000.

Now 6000 = 2 4 3 5 3 6000 = 2^{4}*3*5^{3} . So since n , ( n + 1 ) n, (n + 1) and ( 2 n + 1 ) (2n + 1) are relatively prime for any positive integer n n , we know that one of them is divisible by 125 125 . The least possible n n for which this can happen is n = 62 n = 62 , which makes 2 n + 1 = 125. 2n + 1 = 125. But 62 63 62*63 is not divisible by 2 4 3 2^{4}*3 , so we will need to advance to the next smallest n n , which will be n = 124 n = 124 , which makes n + 1 = 125 n + 1 = 125 . But 124 249 124*249 is not divisible by 2 4 3 2^{4}*3 , so we need to advance to the next smallest n n .

Now we need to move through the sequence of increasing possible values of n n based on the "divisibility by 125 125 " criterion to find a product n ( n + 1 ) ( 2 n + 1 ) n(n + 1)(2n + 1) that is also divisible by 2 4 3. 2^{4}*3. The sequence of such n n goes as follows:

62 , 124 , 125 , 187 , 249 , 250 , 312 , 374 , 375 , 437 , 499 , 500 , 562 , 624. 62, 124, 125, 187, 249, 250, 312, 374, 375, 437, 499, 500, 562, 624.

Only once we reach 624 625 1249 = 2 4 3 5 4 13 1249 624*625*1249 = 2^{4}*3*5^{4}*13*1249 do we have all the prime divisors in sufficient powers to satisfy the divisibility by 6000 6000 requirement. Thus the least such value n n is 624 \boxed{624} .

I know that there is a less "bashy" substitute for the last stage of my solution, but for now I just wanted to get a solution posted and I'll worry about tightening it up later.

It is necessary and sufficient that: either n n or n + 1 n+1 is divisible by 16 16 and either n , n + 1 , n,n+1, or 2 n + 1 2n+1 is divisible by 125 125 . This leads to six different Chinese Remainder Theorem computations mod 2000 2000 , which end up as 0 , 624 , 687 , 1312 , 1375 , 1999 0, 624, 687, 1312,1375,1999 . The smallest positive integer in these congruence classes is 624 \fbox{624} .

Patrick Corn - 6 years, 3 months ago

Log in to reply

Right, of course. ( 2 n + 1 ) (2n + 1) is always odd, and one of n , ( n + 1 ) n, (n + 1) is always odd, so we require that either n n or ( n + 1 ) (n + 1) be divisible by 16 16 . And as Rahul points out, divisibility of the product by 3 3 is already guaranteed.

The CRT tightens the process considerably. Thanks for the refinements. :)

Brian Charlesworth - 6 years, 3 months ago

Just a slight improvement. n ( n + 1 ) ( 2 n + 1 ) n(n+1)(2n+1) is always divisible by 3 3 ,so we don't need to see every time if the expression is divisible by 3 3 or not.

Just to clarify a bit more:many might ask why we are taking the 2 2 under consideration,since there is always a factor of 2 2 in n ( n + 1 ) ( 2 n + 1 ) n(n+1)(2n+1) ,but the thing is that if we do not take that under consideration,then we may include the cases where 2 3 n ( n + 1 ) ( 2 n + 1 ) 2^3|n(n+1)(2n+1) but 2 4 2^4 does not divide n ( n + 1 ) ( 2 n + 1 ) n(n+1)(2n+1) .

Rahul Saha - 6 years, 3 months ago

Log in to reply

Ah, yes. If n 0 m o d 3 n \equiv 0 \mod{3} then the product is divisible by 3 3 ; if n 2 m o d 3 n \equiv 2 \mod{3} then ( n + 1 ) (n + 1) is divisible by 3 3 and hence so is the product; and if n 1 m o d 3 n \equiv 1 \mod{3} then ( 2 n + 1 ) (2n + 1) is divisible by 3 3 .

So after the divisibility by 125 125 criterion is met, the only other criterion is that the product is divisible by 2 4 = 16. 2^{4} = 16.

Brian Charlesworth - 6 years, 3 months ago
Brock Brown
Feb 17, 2015

Python:

1
2
3
4
5
6
k = 1
total = 1
while total % 1000 != 0:
    k += 1
    total += k**2
print "Answer:", k

Ashwin Kumar
Sep 5, 2015

Just for fun i tried to write a c ++ program. And found the out put as 624.

Here is the code if your interested http://pasted.co/b8faefe2

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...