login
A337305
a(n) is the greatest number m not yet in the sequence such that the ternary expansions of n and of m have the same runs of consecutive equal digits (up to order but with multiplicity).
2
0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 21, 12, 13, 22, 19, 16, 25, 18, 15, 20, 11, 14, 23, 24, 17, 26, 27, 28, 63, 30, 37, 64, 57, 48, 75, 36, 31, 66, 39, 40, 67, 58, 49, 76, 55, 46, 69, 34, 43, 70, 73, 52, 79, 54, 45, 56, 33, 42, 65, 60, 61, 74, 29, 32, 59, 38, 41
OFFSET
0,3
COMMENTS
This sequence is the base 3 analog of A337304.
This sequence is a self-inverse permutation of the nonnegative integers.
EXAMPLE
For n = 144:
- the ternary representation of 144 is "12100",
- the corresponding runs of consecutive equal digits are: "1", "2", "1", "00",
- there are five numbers k with the same multiset of runs:
k ter(k)
--- -------
86 "10012"
88 "10021"
136 "12001"
144 "12100"
190 "21001"
- so a(86) = 190,
a(88) = 144,
a(136) = 136,
a(144) = 88,
a(190) = 86.
PROG
(PARI) See Links section.
CROSSREFS
Sequence in context: A321524 A321464 A263273 * A264966 A308728 A201543
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Aug 22 2020
STATUS
approved