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”).

A379657
The nonadjacent form of a(n) is obtained by inserting a digit 0 before each nonzero digit in the balanced ternary expansion of n.
2
0, 1, 3, 2, 5, 11, 6, 13, 7, 4, 9, 19, 10, 21, 43, 22, 45, 23, 12, 25, 51, 26, 53, 27, 14, 29, 15, 8, 17, 35, 18, 37, 75, 38, 77, 39, 20, 41, 83, 42, 85, 171, 86, 173, 87, 44, 89, 179, 90, 181, 91, 46, 93, 47, 24, 49, 99, 50, 101, 203, 102, 205, 103, 52, 105
OFFSET
0,3
COMMENTS
A permutation of the nonnegative integers with inverse A379658.
FORMULA
A334913(a(n)) = A065363(n).
EXAMPLE
The first terms are: n a(n) bter(n) naf(a(n))
-- ---- ------- ---------
0 0 0 0
1 1 1 1
2 3 1T 10T
3 2 10 10
4 5 11 101
5 11 1TT 10T0T
6 6 1T0 10T0
7 13 1T1 10T01
8 7 10T 100T
9 4 100 100
10 9 101 1001
11 19 11T 1010T
12 10 110 1010
PROG
(PARI) a(n) = { my (v = 0, d, b = 1); while (n, d = centerlift(Mod(n, 3)); n = (n-d)/3;
v += d * b; b *= if (d, 4, 2); ); v; }
CROSSREFS
See A048680 for a similar sequence.
Cf. A065363, A334913, A379658 (inverse).
Sequence in context: A195104 A338879 A257905 * A305878 A093924 A130597
KEYWORD
nonn,base,new
AUTHOR
Rémy Sigrist, Dec 29 2024
STATUS
approved