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!)
A065368 Alternating sum of ternary digits in n. Replace 3^k with (-1)^k in ternary expansion of n. 10
0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, 2, 3, 4, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, -3, -2, -1, 0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, -3, -2, -1, -4, -3, -2, -1, 0, 1, -2, -1, 0, -3, -2, -1, 0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, 2, 3, 4, 1, 2, 3, 0, 1, 2, 3, 4, 5, 2, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Notation: (3)[n](-1).
Fixed point of the morphism 0 -> 0,1,2; 1 -> -1,0,1; 2 -> -2,-1,0; ...; n -> -n,-n+1,-n+2. - Philippe Deléham, Oct 22 2011
LINKS
FORMULA
a(n) = Sum_{k>=0} A030341(n,k)*(-1)^k. - Philippe Deléham, Oct 22 2011.
G.f. A(x) satisfies: A(x) = x * (1 + 2*x) / (1 - x^3) - (1 + x + x^2) * A(x^3). - Ilya Gutkovskiy, Jul 28 2021
EXAMPLE
15 = +1(9)+2(3)+0(1) -> +1(+1)+2(-1)+0(+1) = -1 = a(15).
PROG
(Python)
from sympy.ntheory.digits import digits
def a(n):
return sum(bi*(-1)**k for k, bi in enumerate(digits(n, 3)[1:][::-1]))
print([a(n) for n in range(104)]) # Michael S. Branicky, Jul 28 2021
CROSSREFS
Sequence in context: A194525 A330466 A282938 * A010751 A194523 A362721
KEYWORD
base,easy,sign
AUTHOR
Marc LeBrun, Oct 31 2001
EXTENSIONS
Initial 0 added by Philippe Deléham, Oct 22 2011
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 23 10:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)