\\ Coded by Indranil Ghosh (indranilg49@gmail.com)

\\ PARI/GP, OEIS sequence: A233277

a054429(n) = 3<<#binary(n\2) - n - 1;

a046699(n) = if(n<0, 1, k=1; while((2*k)!%2^(n-1)>0, k++); k);

a053644(n) = if(n==0, 0, 2^(#binary(n) - 1));

a043545(n) = x=binary(n); if(n<2, 0, vecmax(x) - vecmin(x));

a079559(n) = if(n==0, 1, a043545(n + 1)*a079559(n + 1 - a053644(n + 1)));

a213714(n) = if(n==0, 0, a079559(n)*(a046699(n + 2) - 1));

a234016(n) = n - (a046699(n + 2) - 1);

a234017(n) = (1 - a079559(n))*a234016(n);

a233275(n) = if(n<2, n, if(a079559(n)==1, 2*a233275(a213714(n) - 1), 1 + (2*a233275(a234017(n)))));

a(n) = if(n==0, 0, a054429(a233275(n)));

for(n=0, 100, print1(a(n),", "))