![]() |
Python
1.0
|
Summing an Arithmetic Progression. More...
Functions | |
def | S (n, a1, d) |
Calculates the sum of the first n terms of an Arithmetic Progression. More... | |
def | Sp (n, a1, d) |
Calculates the sum of the first n terms of an Arithmetic Progression. More... | |
def | main () |
Summing an Arithmetic Progression.
An arithmetic progression or arithmetic sequence is a sequence of numbers such that the difference of any two successive members of the sequence is a constant.
For instance, the sequence 3, 5, 7, 9, 11, 13... is an arithmetic progression with common difference d=2, and first element a1=3.
def _02a_Arithmetic_Progression.main | ( | ) |
References _01d_dec2bin.input, validateRoman.raw_input, S(), and Sp().
def _02a_Arithmetic_Progression.S | ( | n, | |
a1, | |||
d | |||
) |
Calculates the sum of the first n terms of an Arithmetic Progression.
n | an index of a term of the progression. |
a1 | first term of the sequence. |
d | difference between to consecutive terms. |
Referenced by main().
def _02a_Arithmetic_Progression.Sp | ( | n, | |
a1, | |||
d | |||
) |
Calculates the sum of the first n terms of an Arithmetic Progression.
n | an index of a term of the progression. |
a1 | first term of the sequence. |
d | difference between to consecutive terms. |
Referenced by main().