login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A379658
The balanced ternary expansion of a(n) is obtained by removing a digit 0 before each nonzero digit in the nonadjacent form of n.
0
0, 1, 3, 2, 9, 4, 6, 8, 27, 10, 12, 5, 18, 7, 24, 26, 81, 28, 30, 11, 36, 13, 15, 17, 54, 19, 21, 23, 72, 25, 78, 80, 243, 82, 84, 29, 90, 31, 33, 35, 108, 37, 39, 14, 45, 16, 51, 53, 162, 55, 57, 20, 63, 22, 69, 71, 216, 73, 75, 77, 234, 79, 240, 242, 729
OFFSET
0,3
COMMENTS
A permutation of the nonnegative integers with inverse A379657.
FORMULA
A065363(a(n)) = A334913(n).
EXAMPLE
The first terms are:
n a(n) naf(n) bter(a(n))
-- ---- ------ ----------
0 0 0 0
1 1 1 1
2 3 10 10
3 2 10T 1T
4 9 100 100
5 4 101 11
6 6 10T0 1T0
7 8 100T 10T
8 27 1000 1000
9 10 1001 101
10 12 1010 110
11 5 10T0T 1TT
12 18 10T00 1T00
PROG
(PARI) a(n) = { my (v = 0, t = 1, d); while (n, if (n%2, n -= d = 2 - (n%4); v += d*t; t /= 3; ); n \= 2; t *= 3; ); return (v); }
CROSSREFS
See A048679 for a similar sequence.
Cf. A065363, A334913, A379657 (inverse).
Sequence in context: A294370 A325984 A178774 * A320273 A379260 A266636
KEYWORD
nonn,base,new
AUTHOR
Rémy Sigrist, Dec 29 2024
STATUS
approved