login
A340253
Lexicographically earliest sequence of distinct nonnegative terms such that for any n >= 0, a(n+1) is obtained by altering the leftmost ternary digit (which is not a leading zero) in a(n) or if this is not possible by altering the rightmost ternary leading zero in a(n).
2
0, 1, 2, 5, 8, 6, 3, 4, 7, 16, 25, 19, 10, 13, 22, 21, 12, 9, 18, 24, 15, 17, 26, 20, 11, 14, 23, 50, 77, 59, 32, 41, 68, 65, 38, 29, 56, 74, 47, 53, 80, 62, 35, 44, 71, 69, 42, 33, 60, 78, 51, 45, 72, 54, 27, 36, 63, 66, 39, 30, 57, 75, 48, 49, 76, 58, 31, 40
OFFSET
0,3
COMMENTS
This sequence appears to be a permutation of the nonnegative integers.
EXAMPLE
The first terms, alongside their ternary representation, are:
n a(n) ter(a(n))
-- ---- ---------
0 0 0
1 1 1
2 2 2
3 5 12
4 8 22
5 6 20
6 3 10
7 4 11
8 7 21
9 16 121
10 25 221
11 19 201
12 10 101
13 13 111
14 22 211
15 21 210
16 12 110
17 9 100
PROG
(PARI) See Links section.
CROSSREFS
See A340250 for similar sequences.
Sequence in context: A182243 A360898 A118119 * A360809 A287013 A057929
KEYWORD
nonn,look,base
AUTHOR
Rémy Sigrist, Jan 02 2021
STATUS
approved