login
A257685
Left inverse for injection A255411: a(0) = 0, after which, if n = A255411(k) for some k, then a(n) = k, otherwise a(n) = 0.
5
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 9, 0, 10, 0, 0, 0, 11, 0, 12, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 15, 0, 16, 0, 0, 0, 17, 0, 18, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 22, 0, 0, 0, 23, 0, 0
OFFSET
0,13
LINKS
FORMULA
a(0) = 0, after which, if n = A255411(k) for some k, then a(n) = k, otherwise a(n) = 0.
a(n) = (1-A257680(n)) * A257684(n).
Other identities:
For all n >= 0, a(A255411(n)) = n. [This sequence works as a left inverse of A255411.]
MATHEMATICA
Position[Select[Range[0, 120], ! MemberQ[IntegerDigits[#, MixedRadix[Reverse@ Range@ 12]], 1] &], #] - 1 & /@ Range[0, 120] /. {} -> 0 // Flatten (* Michael De Vlieger, May 30 2016, Version 10.2 *)
PROG
(Scheme) (define (A257685 n) (* (- 1 (A257680 n)) (A257684 n)))
(Python)
from sympy import factorial as f
def a007623(n, p=2):
return n if n<p else a007623(n//p, p+1)*10 + n%p
def a257684(n):
x=str(a007623(n))[:-1]
y="".join(str(int(i) - 1) if int(i)>0 else '0' for i in x)[::-1]
return 0 if n==1 else sum([int(y[i])*f(i + 1) for i in range(len(y))])
def a257680(n): return 1 if '1' in str(a007623(n)) else 0
def a(n): return (1 - a257680(n))*a257684(n)
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 21 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 04 2015
STATUS
approved