Answer:
If p is the smallest of n consecutive integers of the same sign than we have p , p+1 , p+2 , … , p+(n−1) ,
So the sum is
∑k=0n−1(p+k)=∑k=0n−1p+∑k=0n−1k=np+n2−n2
Here n=4
So we have 4p+6
And checking
p+(p+1)+(p+2)+(p+3)=4p+6
Note if p=−v
Than you have the same thing as if p=v−n+1 just negative for example 3 consecutive integers the smallest is −5 so the sum is −5+(−4)+(−3)=3×−5+32−32=−15+3=−12
On the other hand:
−(3+4+5)=−(3×3+32−32)=−(9+3)=−12
If p=−v the sum of next v+1 integers is −(∑k=0vk)=−(v2+v2)
Than needs an other v integers to bring it up to 0 again. From there it is
∑k=0hk=h2+h2
Where h=n−(2v+1) .
So recap if p is the smallest of n consecutive integers their sum is
p+(p+1)+(p+2)+…+(p+(n−1))=⎧⎩⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪np+n2+n2−(n|p|+n2+n2)((n−|p|)2+(n−|p|)2)−(|p|p+|p|2+|p|2)((n−|p|)2+(n−|p|)2)n≥0p<0∧n<|p|+1p<0∧|p|<n<2|p|+1p<0∧n>2|p|+1
Explanation: