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!)
A333773 Replace 2's with (-1)'s in ternary representation of n and sum nonzero terms with alternating signs. 2
0, 1, -1, 3, 2, 4, -3, -4, -2, 9, 8, 10, 6, 7, 5, 12, 13, 11, -9, -10, -8, -12, -11, -13, -6, -5, -7, 27, 26, 28, 24, 25, 23, 30, 31, 29, 18, 19, 17, 21, 20, 22, 15, 14, 16, 36, 37, 35, 39, 38, 40, 33, 32, 34, -27, -28, -26, -30, -29, -31, -24, -23, -25, -36 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
This sequence is a variant of A117966, and shares features with A065620.
Every integer appears exactly once in this sequence.
LINKS
FORMULA
a(3*n) = 3*a(n).
a(3*n+1) = 3*a(n) + (-1)^A160384(n).
a(3*n+2) = 3*a(n) - (-1)^A160384(n).
Sum_{k=0..n} a(k) >= 0 with equality iff n belongs to A024023.
a(n) > 0 iff n belongs to A132141.
a(n) < 0 iff n belongs to A157671.
a(A004488(n)) = -a(n).
EXAMPLE
For n = 97:
- 97 = 3^4 + 3^2 + 2*3^1 + 3^0,
- hence a(97) = 3^4 - 3^2 + (-1)*3^1 - 3^0 = 68.
PROG
(PARI) a(n) = { my (v=0, t=Vecrev(digits(n, 3))); for (k=1, #t, if (t[k]==1, v=+3^(k-1)-v, t[k]==2, v=-3^(k-1)-v)); v }
CROSSREFS
Sequence in context: A247190 A243289 A134559 * A007456 A316141 A119707
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Apr 05 2020
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 April 16 18:12 EDT 2024. Contains 371750 sequences. (Running on oeis4.)