######################################################### # # # Coded by Indranil Ghosh (indranilg49@gmail.com) # # # ######################################################### #Python 2.7.11, OEIS sequence: A233275 from sympy import factorial def a046699(n): if n<3: return 1 s=1 while factorial(2*s)%(2**(n - 1))>0: s+=1 return s def a053644(n): return 0 if n==0 else 2**(len(bin(n)[2:]) - 1) def a043545(n): x=bin(n)[2:] return int(max(x)) - int(min(x)) def a079559(n): return 1 if n==0 else a043545(n + 1)*a079559(n + 1 - a053644(n + 1)) def a213714(n): return 0 if n==0 else a079559(n)*(a046699(n + 2) - 1) def a234016(n): return n - (a046699(n + 2) - 1) def a234017(n): return (1 - a079559(n))*a234016(n) def a(n): return n if n<2 else 2*a(a213714(n) - 1) if a079559(n)==1 else 1 + (2*a(a234017(n))) print [a(n) for n in xrange(101)]