login
A nonlinear recurrence.
(Formerly M0282)
1

%I M0282 #19 Nov 04 2022 07:30:55

%S 1,1,2,2,3,4,5,7,9,11,14,18,23,29,38,47,59,76,95,120,154,191,241,310,

%T 383,483,620,767,968,1242,1535,1937,2486,3071,3875,4972,6143,7752,

%U 9946,12287,15505,19894,24575,31011,39788,49151,62024,79578,98303

%N A nonlinear recurrence.

%D D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, p. 208.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H G. C. Greubel, <a href="/A003073/b003073.txt">Table of n, a(n) for n = 0..5000</a>

%t A003073[n_]:= If[Mod[n,3]==0, Floor[3*2^Floor[n/3]/2] - Boole[Floor[n/3] >0], If[Mod[n, 3]==2, 2*Floor[17*2^Floor[n/3]/14] +Boole[Floor[n/3] == 2], Floor[53*2^Floor[n/3]/28] - Boole[Floor[n/3] >2] ]];

%t Table[A003073[n], {n, 0, 60}] (* _G. C. Greubel_, Nov 03 2022 *)

%o (PARI) a(n)=local(k); k=n\3; if(n%3==0,3*2^k\2-(k>0), if(n%3==2, 2*(17*2^k\14)+(k==2),53*2^k\28-(k>2))) /* _Michael Somos_, May 04 2000 */

%o (SageMath)

%o def A003073(n):

%o if (n%3==0): return ((3*2^(n//3))//2) - int((n//3)>0)

%o elif (n%3==2): return 2*((17*2^(n//3))//14) + int((n//3)==2)

%o else: return ((53*2^(n//3))//28) - int((n//3)>2)

%o [A003073(n) for n in range(61)] # _G. C. Greubel_, Nov 03 2022

%K nonn

%O 0,3

%A _N. J. A. Sloane_

%E More terms from _Michael Somos_, May 04 2000