Share your repls and programming experiences

← Back to all posts
Arithmetic progression
DEMONul1234 (11)

Example:

a1 - first nr of progression
r - constant difference(a1 = 2, a2 = 4, so r=4-2=2)
an - nr of progression you want to have a value of

a1=3, r=3, a5=?

a5 = a1 + 4r
a5 = 3 + 12
a5 = 15