login
A371261
Lexicographically latest sequence of distinct nonnegative integers such that the run lengths transforms of the ternary expansions of n and of a(n) are the same.
2
0, 2, 1, 7, 8, 6, 5, 3, 4, 22, 23, 21, 25, 26, 24, 20, 19, 18, 17, 16, 15, 11, 9, 10, 14, 12, 13, 67, 68, 66, 70, 71, 69, 65, 64, 63, 76, 77, 75, 79, 80, 78, 74, 73, 72, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 35, 34, 33, 29, 27
OFFSET
0,2
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
FORMULA
A371256(a(n)) = A371256(n).
a(A371257(n, k)) = A371257(n, 2^A005811(n) + 1 - k) for any n >= 0 and k in 1..2^A005811(n).
EXAMPLE
The first terms, in decimal and in base 3, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
0 0 0 0
1 2 1 2
2 1 2 1
3 7 10 21
4 8 11 22
5 6 12 20
6 5 20 12
7 3 21 10
8 4 22 11
9 22 100 211
10 23 101 212
11 21 102 210
12 25 110 221
13 26 111 222
14 24 112 220
15 20 120 202
PROG
(PARI) \\ See Links section.
CROSSREFS
See A371267 for a similar sequence.
Sequence in context: A144749 A021463 A371268 * A199964 A217107 A320432
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 16 2024
STATUS
approved