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).
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
Examples
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.
Links
Programs
-
PARI
See Links section.
Comments