%I #38 Mar 01 2022 20:34:28
%S 0,2,18,146,1170,9362,74898,599186,4793490,38347922,306783378,
%T 2454267026,19634136210,157073089682,1256584717458,10052677739666,
%U 80421421917330,643371375338642,5146971002709138,41175768021673106,329406144173384850,2635249153387078802,21081993227096630418
%N Numbers whose base-8 or octal representation is 22222222.......2.
%H G. C. Greubel, <a href="/A125835/b125835.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (9,-8).
%F a(n) = 2*(8^(n-1) - 1)/7.
%F a(n) = 8*a(n-1) + 2, with a(1)=0. - _Vincenzo Librandi_, Sep 30 2010
%F From _G. C. Greubel_, Aug 03 2019: (Start)
%F a(n) = 2*A023001(n).
%F G.f.: 2*x^2/((1-x)*(1-8*x)).
%F E.g.f.: 2*(exp(8*x) - exp(x))/7. (End)
%e Octal.............decimal
%e 0.......................0
%e 2.......................2
%e 22.....................18
%e 222...................146
%e 2222.................1170
%e 22222................9362
%e 222222..............74898
%e 2222222............599186
%e 22222222..........4793490
%e 222222222........38347922
%e 2222222222......306783378
%e etc. ...............etc.
%p seq(2*(8^n-1)/7, n=0..30);
%t 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 *)
%t Module[{nn=30,c},c=PadRight[{},nn,2];Table[FromDigits[Take[c,n],8],{n,0,nn}]] (* _Harvey P. Dale_, Sep 05 2015 *)
%t 2*(8^(Range[30]-1) -1)/7 (* _G. C. Greubel_, Aug 03 2019 *)
%o (PARI) a(n)=2*(1<<(3*n-3)\7) \\ _Charles R Greathouse IV_, Mar 09 2011
%o (PARI) vector(30, n, 2*(8^(n-1) -1)/7) \\ _G. C. Greubel_, Aug 03 2019
%o (Magma) [2*(8^(n-1) -1)/7: n in [1..30]]; // _G. C. Greubel_, Aug 03 2019
%o (Sage) [2*(8^(n-1) -1)/7 for n in (1..30)] # _G. C. Greubel_, Aug 03 2019
%o (GAP) List([1..30], n-> 2*(8^(n-1) -1)/7); # _G. C. Greubel_, Aug 03 2019
%Y Cf. A023001.
%K easy,nonn
%O 1,2
%A _Zerinvary Lajos_, Feb 03 2007
%E Offset corrected by _N. J. A. Sloane_, Oct 02 2010
%E Terms a(21) onward added by _G. C. Greubel_, Aug 03 2019
|