OFFSET
0,11
COMMENTS
FORMULA
a(n) <= n with equality iff n = 0 or n belongs to A266946.
a(a(n)) = a(n).
EXAMPLE
For n = 65507668: the different digits appearing in 65507668 are 6, 5, 0, 7 and 8; so we replace 6's by 1's, 5's by 0's, 0's by 2's, 7's by 3's and 8's by 4's, and a(65507668) = 10023114.
PROG
(PARI) a(n, base = 10) = { my (d = digits(n, base), m = vector(base, i, -1), u = 1); for (i = 1, #d, if (m[1+d[i]] < 0, m[1+d[i]] = u; u = if (u==1, 0, u==0, 2, u+1); ); d[i] = m[1+d[i]]; ); fromdigits(d, base); }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Aug 04 2024
STATUS
approved