The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A371635 For any number k >= 0, let T_k be the triangle with values in {-1, 0, +1} whose base corresponds to the balanced ternary expansion of k (without leading zeros) and other values, say t above u and v, satisfy t+u+v = 0 mod 3; the balanced ternary expansion of a(n) corresponds to the left border of T_n (the most significant digit being at the bottom left corner). 2
0, 1, 3, 2, 4, 10, 8, 9, 6, 7, 5, 11, 12, 13, 30, 29, 31, 24, 23, 25, 27, 26, 28, 18, 17, 19, 21, 20, 22, 15, 14, 16, 33, 32, 34, 36, 35, 37, 39, 38, 40, 91, 89, 90, 86, 87, 88, 93, 94, 92, 73, 71, 72, 68, 69, 70, 75, 76, 74, 82, 80, 81, 77, 78, 79, 84, 85, 83 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
This sequence is a variant of A334727 and A361832.
This sequence is a self-inverse permutation of the nonnegative integers.
LINKS
EXAMPLE
For n = 42: the balanced ternary expansion of 42 is "1TTT0" (where T denotes -1), and T_42 is as follows:
T
0 1
1 T 0
0 T T 1
1 T T T 0
So the balanced ternary expansion of a(42) is "1010T", and a(42) = 89.
PROG
(PARI) a(n) = { my (b = [], d); while (n, b = concat(d = Mod(n, 3), b); n = (n-centerlift(d)) / 3; ); my (t = vector(#b)); for (i = 1, #t, t[i] = centerlift(b[1]); b = -vector(#b-1, j, b[j]+b[j+1]); ); fromdigits(t, 3); }
CROSSREFS
Sequence in context: A260596 A265353 A266189 * A368226 A277743 A296099
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 30 2024
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 13 17:32 EDT 2024. Contains 373391 sequences. (Running on oeis4.)