-2

How easy sum all odd numbers in range?

As instance: 25 + 27 + 29 + 31?

Which formula I should apply?

J. W. Tanner
  • 60,406
Jony
  • 127

2 Answers2

1

Since you indicated in comments you know how to sum the first $n$ odd numbers ($n^2$):

$25+27+29+31=$

$(1+3+5+7+9+11+13+15+17+19+21+23+25+27+29+31)-$

$(1+3+5+7+9+11+13+15+17+19+21+23)=$

$ 16^2-12^2=(16+12)(16-12)=28\times4=112$

J. W. Tanner
  • 60,406
0

See that

$$25+27+29+31 = 25+(25+2) + (25+4) + (25 +6)$$

$$= 4(25) + 2+4+6 = 4(25) + 2(1+2+3).$$