Respuesta :

If

[tex]S=1+2+\cdots+(n-1)+n[/tex]

then it's also true that

[tex]S=n+(n-1)+\cdots+2+1[/tex]

so that

[tex]2S=(1+n)+(2+(n-1))+\cdots+((n-1)+2)+(n+1)=n(n+1)\implies S=\dfrac{n(n+1)}2[/tex]

For any integer [tex]n[/tex], [tex]n(n+1)[/tex] is even. We have [tex]5\mid S[/tex] if either [tex]5\mid n[/tex] or [tex]5\mid(n+1)[/tex]. This means [tex]n[/tex] must satisfy either [tex]n\equiv0\pmod5[/tex] or [tex]n\equiv4\pmod5[/tex], in which case we have a general solution of

[tex]n=5k[/tex]

or

[tex]n=5k-1[/tex]

where [tex]k[/tex] is any integer.