Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I calculated sum of n consecutive natural numbers where n = 1 to 100 .What I mean is $$\sum_{n=1}^{1}n = 1 $$ $$\sum_{n=1}^{2}n = 3 $$ $$\sum_{n=1}^{3}n = 6 $$

And I got answers and noticed that none of the summation answers ended in digits $7,4,2,9 $

I verified with the code in python for the first 100 numbers


for n in range(1,100):
    a =0
    for i in range(1,n+1):
        a = a + i
    print a%10

Why is it so ? I just checked for 100 numbers . Does this hold good for any number n ? If so, can we prove this ?

share|improve this question
4  
Yes, this is correct. Note that $8\cdot 1+1=9$, $8\cdot 3+1=25$ and $8\cdot 6+1=49$. In general, if $S$ is your sum, then $8S+1$ is a perfect square. So no $S$ ends in those digits because no square ends in $3$ or $7$. –  Thomas Andrews Jul 24 '13 at 22:26
    
Thanks Thomas Andrews . Your comment was very useful to solve this problem. –  Harish Kayarohanam Jul 24 '13 at 23:04

2 Answers 2

up vote 5 down vote accepted

The numbers you're computing are called triangular numbers, and they are of the form:

$$\frac{n(n+1)}{2}$$

Suppose we have:

$$\frac{n(n+1)}{2}=10m+k$$

This tells us that the quantity $n(n+1)$ is congruent to $2k$ modulo $20$. So our task is to show that $n(n+1)$ is never congruent to $4,8,14,$ or $18$ modulo $20$. This you can check on a case by case basis, by letting $n$ range from $0$ to $19$.

Or, using the clever hint given by Thomas Andrews in the comments, notice that

$$8\frac{n(n+1)}{2}+1=4n^2+4n+1=(2n+1)^2=80m+8k+1$$

With $k=2,4,7,9$, it would follows that $(2n+1)^2$ ends in a $7$ or $3$, which is impossible.

share|improve this answer
    
Amazing answer .Thanks . Your proof along with Thomas Andrews comment is really helpful . –  Harish Kayarohanam Jul 24 '13 at 22:43
    
Tiny bit of cleanup: you can in fact just work mod 10 instead of mod 20, since '4, 8, 14, or 18 mod 20' is exactly equivalent to '4 or 8 mod 10'. –  Steven Stadnicki Jul 24 '13 at 23:21

HINT: $$\sum_{n=1}^{r}n = n(n-1)/2 $$

Now you are asking that why $n(n-1)/2$ does not end with digits like 2 ,4 ,7,9

Product of two consecutive Natural numbers always ends with 0,2,6 ( Intuitive Prove!)
So $n(n-1)/2$ will have digits ending with 0,1,3,5 . (where 5 comes in the case where the last two digits are 1 and 0 )

share|improve this answer
    
Thanks Simar .I am getting your point. Your answer was helpful. can you please edit it and make it clear .Point is as 0,2,6 are only ending digits , possible ending digits after division by 2 ,are 0 or 5(for 0 as we can have 0 or 10) , 1 or 6 (for 2 as we can have 2 or 12) , 3 or 8 (for 6 as we can have 6 or 16) . so possible ending digits are 1,3,5,6,8 . so left out digits are 2,4,7,9. –  Harish Kayarohanam Jul 24 '13 at 22:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.