######################################################### # # # Coded by Indranil Ghosh (indranilg49@gmail.com) # # # ######################################################### #Python 2.7.11, OEIS sequence: A286601 from sympy import prime, factorint, floor, log def A(n): return n - 2**int(floor(log(n, 2))) def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n)) def P(n): f = factorint(n) return sorted([f[i] for i in f]) def a046523(n): x=1 while True: if P(n) == P(x): return x else: x+=1 def a278222(n): return a046523(b(n)) def a065621(n): return n^(2*(n - (n&-n))) def a048724(n): return n^(2*n) def a193231(n): return n if n<2 else a048724(a193231(n/2)) if n%2==0 else a065621(1 + a193231((n - 1)/2)) def a(n): return a278222(a193231(n)) print [a(n) for n in xrange(101)]