OFFSET
0,2
COMMENTS
In general, the ordinary generating function for the recurrence b(n) = k^n - b(n-1), where n>0 and b(0)=0, is k*x/((1 + x)*(1 - k*x)). This recurrence gives the closed form b(n) = k*(k^n - (-1)^n))/(k + 1).
LINKS
FORMULA
EXAMPLE
a(2) = 7^2 - a(2-1) = 49 - 7 = 42.
a(4) = 7^4 - a(4-1) = 2401 - 301 = 2100.
MATHEMATICA
LinearRecurrence[{6, 7}, {0, 7}, 30]
Table[7 (7^n - (-1)^n)/8, {n, 0, 30}]
PROG
(PARI) vector(50, n, n--; 7*(7^n-(-1)^n)/8) \\ Altug Alkan, Apr 13 2016
(Python) for n in range(0, 10**2):print((int)((7*(7**n-(-1)**n))/8))
# Soumil Mandal, Apr 14 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ilya Gutkovskiy, Apr 13 2016
STATUS
approved