Sequences and series
The program calculates the first n terms of a sequence (ai) and the corresponding series Σai (sum of the sequence terms) if an explicit function ai=ƒ(i) or the first terms of the sequence and a recourse formula ai=ƒ(a0, a1, ... , ai-1) are given.
The sequence of odd numbers
It can be defined explicitly by ai = 2·i + 1 :
a[0] ... =
a[ i ] = 2*i + 1
n = 10
a[i] = 2*i + 1; n = 10; Sequence ¯¯¯¯¯¯¯¯ ( a[ i ] ) = (1; 3; 5; 7; 9; 11; 13; 15; 17; 19) Series ¯¯¯¯¯ ( Σ a[ i ] ) = (1; 4; 9; 16; 25; 36; 49; 64; 81; 100)
or recursively by ai = ai-1 + 2 with a0=1 .
a[0] ... = 1
a[ i ] = a[i-1]+2
n = 10
a[0] = 1; a[i] = a[i-1]+2; n = 10; Sequence ¯¯¯¯¯¯¯¯ ( a[ i ] ) = (1; 3; 5; 7; 9; 11; 13; 15; 17; 19) Series ¯¯¯¯¯ ( Σ a[ i ] ) = (1; 4; 9; 16; 25; 36; 49; 64; 81; 100)
The corresponding series is obviously the sequence of the square numbers. This can be proved very nicely by complete induction. ( Wikipedia: Mathematical induction / Sum of consecutive natural numbers )
The Fibonacci Sequence
One of the most popular recursive sequences starts with a0=1 and a1=1 . The other terms are equal to the sum of the previous two.
a[0] ... = 1; 1
a[ i ] = a[i-1]+a[i-2]
n = 20
a[0]=1; a[1]=1; a[ i ] = a[i-1]+a[i-2]; n = 20 Sequence ¯¯¯¯¯¯¯¯ ( a[ i ] ) = (1; 1; 2; 3; 5; 8; 13; 21; 34; 55; 89; 144; 233; 377; 610; 987; 1597; 2584; 4181; 6765) Series ¯¯¯¯¯ ( Σ a[ i ] ) = (1; 2; 4; 7; 12; 20; 33; 54; 88; 143; 232; 376; 609; 986; 1596; 2583; 4180; 6764; 10945; 17710)
See also:
Wikipedia: Sequence | Fibonacci number

