[go: up one dir, main page]

login
A353648
Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, n and a(n) can be added without carries in balanced ternary.
2
0, 2, 1, 5, 6, 3, 4, 17, 15, 14, 18, 16, 19, 23, 9, 8, 11, 7, 10, 12, 51, 50, 53, 13, 44, 45, 42, 41, 47, 43, 46, 54, 48, 49, 56, 52, 55, 57, 69, 68, 71, 27, 26, 29, 24, 25, 30, 28, 32, 33, 21, 20, 35, 22, 31, 36, 34, 37, 149, 153, 152, 155, 150, 151, 156, 154
OFFSET
0,2
COMMENTS
Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position.
This sequence is a self-inverse permutation of the nonnegative integers with a single fixed point: a(0) = 0.
EXAMPLE
The first terms, in decimal and in balanced ternary, are:
n | 0 1 2 3 4 5 6 7 8 9 10 11 12
a(n) | 0 2 1 5 6 3 4 17 15 14 18 16 19
bter(n) | 0 1 1T 10 11 1TT 1T0 1T1 10T 100 101 11T 110
bter(a(n))| 0 1T 1 1TT 1T0 10 11 1T0T 1TT0 1TTT 1T00 1TT1 1T01
PROG
(PARI) ok(u, v) = { while (u && v, my (uu=[0, +1, -1][1+u%3], vv=[0, +1, -1][1+v%3]); if (abs(uu+vv)>1, return (0)); u=(u-uu)/3; v=(v-vv)/3); 1 }
{ s=0; for (n=0, 65, for (v=0, oo, if (!bittest(s, v) && ok(n, v), print1 (v", "); s+=2^v; break))) }
CROSSREFS
Cf. A059095, A238757 (binary analog), A353649.
Sequence in context: A341487 A162750 A330984 * A075680 A192024 A249283
KEYWORD
nonn,look,base
AUTHOR
Rémy Sigrist, May 01 2022
STATUS
approved