OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (9,-8).
FORMULA
a(n) = 2*(8^(n-1) - 1)/7.
a(n) = 8*a(n-1) + 2, with a(1)=0. - Vincenzo Librandi, Sep 30 2010
From G. C. Greubel, Aug 03 2019: (Start)
a(n) = 2*A023001(n).
G.f.: 2*x^2/((1-x)*(1-8*x)).
E.g.f.: 2*(exp(8*x) - exp(x))/7. (End)
EXAMPLE
Octal.............decimal
0.......................0
2.......................2
22.....................18
222...................146
2222.................1170
22222................9362
222222..............74898
2222222............599186
22222222..........4793490
222222222........38347922
2222222222......306783378
etc. ...............etc.
MAPLE
seq(2*(8^n-1)/7, n=0..30);
MATHEMATICA
nxt2[n_]:=Module[{idn=IntegerDigits[n, 8]}, FromDigits[PadLeft[idn, Length[idn]+1, 2], 8]]; Join[{0}, NestList[nxt2, 2, 30]] (* Harvey P. Dale, Mar 09 2011 *)
Module[{nn=30, c}, c=PadRight[{}, nn, 2]; Table[FromDigits[Take[c, n], 8], {n, 0, nn}]] (* Harvey P. Dale, Sep 05 2015 *)
2*(8^(Range[30]-1) -1)/7 (* G. C. Greubel, Aug 03 2019 *)
PROG
(PARI) a(n)=2*(1<<(3*n-3)\7) \\ Charles R Greathouse IV, Mar 09 2011
(PARI) vector(30, n, 2*(8^(n-1) -1)/7) \\ G. C. Greubel, Aug 03 2019
(Magma) [2*(8^(n-1) -1)/7: n in [1..30]]; // G. C. Greubel, Aug 03 2019
(Sage) [2*(8^(n-1) -1)/7 for n in (1..30)] # G. C. Greubel, Aug 03 2019
(GAP) List([1..30], n-> 2*(8^(n-1) -1)/7); # G. C. Greubel, Aug 03 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Zerinvary Lajos, Feb 03 2007
EXTENSIONS
Offset corrected by N. J. A. Sloane, Oct 02 2010
Terms a(21) onward added by G. C. Greubel, Aug 03 2019
STATUS
approved