######################################################### # # # Coded by Indranil Ghosh (indranilg49@gmail.com) # # # ######################################################### #Python 2.7.11, OEIS sequence: A273667 from sympy import factorial as f def a007623(n, p=2): return n if n
0 else '0' for i in x])[::-1] return 0 if n==0 else sum([int(y[i])*f(i + 1) for i in xrange(len(y))]) def a257680(n): return 1 if '1' in str(a007623(n)) else 0 def a266193(n): x=str(a007623(n))[::-1] y="".join([str(i) if i + 1==int(x[i]) else x[i] for i in xrange(len(x))])[1:] return 0 if n==0 else sum([int(y[i])*f(i + 1) for i in xrange(len(y))]) def a257511(n): return str(a007623(n)).count("1") def a256450(n): if n==0: return 1 x=a256450(n - 1) return x + 1 if a257511(1 + x)>0 else x + 2 def a257680(n): return 1 if '1' in str(a007623(n)) else 0 def a273663(n): return 0 if n==1 else a257680(a225901(n)) + a273663(n - 1) l=[0] for n in xrange(1, 101): l+=[a255411(l[a266193(n)]) if a257680(a225901(n))==0 else a256450(l[a273663(n)]), ] print l