OFFSET
0,3
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers. See A332520 for the corresponding fixed points.
For any m > 1, we can devise a similar sequence by considering bases of the form m^2^k (with k >= 0).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..65536
Rémy Sigrist, Scatterplot of the first 2^2^4 terms
Rémy Sigrist, Colored scatterplot of the first 2^2^4 terms (where the color denotes the base b if any)
FORMULA
a(n) < 2^2^k iff n < 2^2^k for any n, k >= 0.
a(2^k) = 2^k for any k >= 0.
a(2^2^k-1) = 2^2^k-1 for any k >= 0.
EXAMPLE
For n = 73:
- the base 2^2^0 representation of 73 is "1001001" which has only one kind of nonzero digits,
- the base 2^2^1 representation of 73 is "1021" which has exactly two kinds of nonzero digits, "1" and "2",
- so the base 2^2^1 representation of a(73) is "2012",
- and a(73) = 134.
PROG
(PARI) a(n) = { for (x=0, oo, my (b=2^2^x, d=if (n, digits(n, b), [0])); if (#d==1, return (n), my (uv=select(sign, Set(d))); if (#uv==2, return (
fromdigits(apply (t -> if (t==0, 0, t==uv[1], uv[2], uv[1]), d), b))))) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 24 2020
STATUS
approved