Share your repls and programming experiences

← Back to all posts
Arithmetic progression
DEMONul1234 (10)

#Note: I'm using my own symbols, they may be different in english.
a1 - First value of progression.
r - a difference between some values,example: a1 = 1, a2 =3 , so r = 3 - 1 = 2

Arithmetic progression:

an = a1 + r

example:
a1 = 8, r = 3, a50 = ?
we want to calculate a value of a50.
a50 = a1 + 49r
a50 = 8 + (49*3)
a50 = 155