[go: up one dir, main page]

login
A352760
Lexigraphically earliest sequence of distinct nonnegative integers such that for any n >= 0, among the ternary digits of n and a(n) (counted with multiplicity) there are as many 1's as 2's.
5
0, 2, 1, 6, 8, 5, 3, 7, 4, 17, 20, 11, 24, 26, 18, 15, 23, 9, 14, 19, 10, 21, 25, 16, 12, 22, 13, 35, 53, 29, 56, 62, 47, 33, 51, 27, 60, 74, 54, 78, 80, 71, 59, 72, 44, 45, 61, 32, 65, 77, 50, 34, 52, 28, 38, 55, 30, 57, 69, 42, 36, 46, 31, 63, 73, 48, 75, 79
OFFSET
0,2
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
FORMULA
a(n) = n iff n belongs to A039001.
a(n) < 3^k iff n < 3^k.
EXAMPLE
The first terms, alongside their ternary expansions, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
0 0 0 0
1 2 1 2
2 1 2 1
3 6 10 20
4 8 11 22
5 5 12 12
6 3 20 10
7 7 21 21
8 4 22 11
9 17 100 122
10 20 101 202
11 11 102 102
12 24 110 220
PROG
(PARI) See Links section.
CROSSREFS
Cf. A004488, A039001 (fixed points), A331275, A355504.
Sequence in context: A138750 A342369 A342842 * A357616 A048850 A004488
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 05 2022
STATUS
approved