

A321474


Reverse the nonzero digits of n.


4



0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 12, 22, 32, 42, 52, 62, 72, 82, 92, 30, 13, 23, 33, 43, 53, 63, 73, 83, 93, 40, 14, 24, 34, 44, 54, 64, 74, 84, 94, 50, 15, 25, 35, 45, 55, 65, 75, 85, 95, 60, 16, 26, 36, 46, 56, 66, 76
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

This sequence is a selfinverse permutation of nonnegative integers.
See A321464 for the ternary variant.
This sequence has similarities with A069799: here we reverse nonzero digits, there we reverse nonzero prime exponents.


LINKS

Rémy Sigrist, Table of n, a(n) for n = 0..10000
Index entries for sequences that are permutations of the natural numbers


FORMULA

a(10 * n) = 10 * a(n).
A136400(a(n)) = A136400(n).


EXAMPLE

For n = 1024:
 1024 has 3 nonzero digits: 1, 2 and 4,
 so we replace the first nonzero digit by the third, the third by the first (and the second remains in place),
 and we obtain a(1024) = 4021.


PROG

(PARI) a(n, base=10) = my (d=digits(n, base), t=Vecrev(select(sign, d)), i=0); for (j=1, #d, if (d[j], d[j] = t[i++])); fromdigits(d, base)


CROSSREFS

Cf. A004086, A069799, A136400, A321464.
Sequence in context: A330760 A064222 A261294 * A333659 A336956 A225805
Adjacent sequences: A321471 A321472 A321473 * A321475 A321476 A321477


KEYWORD

nonn,base


AUTHOR

Rémy Sigrist, Nov 11 2018


STATUS

approved



