How easy sum all odd numbers in range?
As instance: 25 + 27 + 29 + 31?
25 + 27 + 29 + 31?
Which formula I should apply?
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$
See that
$$25+27+29+31 = 25+(25+2) + (25+4) + (25 +6)$$
$$= 4(25) + 2+4+6 = 4(25) + 2(1+2+3).$$
Copyright © 2021 JogjaFile Inc.
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$