|
|
A037488
|
|
Base 3 digits are, in order, the first n terms of the periodic sequence with initial period 2,1.
|
|
0
|
|
|
2, 7, 23, 70, 212, 637, 1913, 5740, 17222, 51667, 155003, 465010, 1395032, 4185097, 12555293, 37665880, 112997642, 338992927, 1016978783, 3050936350, 9152809052, 27458427157, 82375281473, 247125844420, 741377533262
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 3*a(n-1) + a(n-2) - 3*a(n-3).
|
|
MATHEMATICA
|
Module[{nn=30, c}, c=PadRight[{}, nn, {2, 1}]; Table[FromDigits[Take[c, n], 3], {n, nn}]] (* or *) LinearRecurrence[{3, 1, -3}, {2, 7, 23}, 30] (* Harvey P. Dale, May 21 2015 *)
|
|
PROG
|
(PARI) a(n)=if(n<1, 0, 3*a(n-1)+1+n%2)
(PARI) a(n)=if(n<1, 0, 3^n*7\8)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|