login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(1)=1, a(2n)=1+a(n)(mod 2); a(2n+1)=2*a(2n)+1.
0

%I #5 Mar 30 2012 18:39:22

%S 1,2,5,1,3,2,5,2,5,2,5,1,3,2,5,1,3,2,5,1,3,2,5,2,5,2,5,1,3,2,5,2,5,2,

%T 5,1,3,2,5,2,5,2,5,1,3,2,5,1,3,2,5,1,3,2,5,2,5,2,5,1,3,2,5,1,3,2,5,1,

%U 3,2,5,2,5,2,5,1,3,2,5,1,3,2,5,1,3,2,5,2,5,2,5,1,3,2,5,2,5,2,5,1,3,2,5,2,5

%N a(1)=1, a(2n)=1+a(n)(mod 2); a(2n+1)=2*a(2n)+1.

%C a(n) mod 2 = A035263(n)

%F a(A003159(n))=1; a(2*A003159(n))=2; a(4*A003159(n)+1)=3; a(2*A003159(n)+1)=5

%o (PARI) a(n)=if(n<2,1,if(n%2,2*a(n-1)+1,1+a(n/2)%2))

%K nonn

%O 1,2

%A _Benoit Cloitre_, Mar 11 2004