k*(k+1)*(2k+1)/6
must be divisible by 100
or
k*(k+1)*(2k+1) must be divisible by 600
600
= 25 * 8 * 3
One
number is always divisible by 3 so we need not check for it. only one that is either k or k + 1 is by 2 (
hence 8) and one by 5 ( hence 25)
So
2k + 1 > = 25 or k > = 12
If
k is even then multiple of 8: so candidates 16,24
If
k is odd then multiple of 8 – 1 that is
15, 23
So
we need to try 15,16,23,24 so on and checking one by one we get 24 as answer
No comments:
Post a Comment