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!)
A020944 a(2n+1) = |a(2n) - a(2n-1)|, a(2n) = a(n) + a(n-1), a(0) = -1. 5
-1, 1, 0, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 2, 1, 1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1, 3, 2, 3, 1, 2, 1, 1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7, 4, 5, 1, 4, 3, 5, 2, 5, 3, 4, 1, 3, 2, 3, 1, 2, 1, 1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,9
COMMENTS
a(n) = abs(t(n+1)) if n>0 where t(n) is the twisted Stern sequence defined by R. Bacher and M. Coons. - Michael Somos, Jan 08 2011
a(A153893(n)) = 0. - Reinhard Zumkeller, Mar 13 2011
LINKS
Roland Bacher, Twisting the Stern sequence, arXiv:1005.5627v1 [math.CO], 2010.
Michael Coons, On Some Conjectures concerning Stern's Sequence and its Twist, arXiv:1008.0193v3 [math.NT], 2010.
FORMULA
G.f. A(x) satisfies: A(x) = 2*x + (1 + x + x^2) * A(x^2). - Michael Somos, Jan 08 2011
EXAMPLE
G.f. = -1 + x + x^3 + x^4 + x^6 + x^7 + 2*x^8 + x^9 + x^10 + x^12 + x^13 + 2*x^14 + ...
MATHEMATICA
a[ n_] := Which[ n < 2, Boole[n == 1] - Boole[n == 0], OddQ[n], Abs[a[n - 1] - a[n - 2]], True, a[n/2] + a[n/2 - 1]]; (* Michael Somos, Jul 25 2018 *)
PROG
(PARI) {a(n) = if( n<2, (n==1) - (n==0), n%2, abs( a(n-1) - a(n-2) ), a(n/2) + a(n/2 - 1) )}; /* Michael Somos, Jan 08 2011 */
(PARI) {a(n) = my(A, m); if( n<0, 0, m = 1; A = -1 + O(x); while( m <= n, m*=2; A = 2*x + (1 + x + x^2) * subst( A, x, x^2 ) ); polcoeff( A, n ) )}; /* Michael Somos, Jan 08 2011 */
(Haskell)
a020944 n = a020944_list !! n
a020944_list = -1 : f [1, 0] where f (x:y:xs) = x : f (y:xs ++ [x, x+y])
-- Same list generator function as for a020951_list, cf. A020951.
-- Reinhard Zumkeller, Mar 13 2013
CROSSREFS
Sequence in context: A275849 A025906 A213369 * A287729 A367582 A025897
KEYWORD
sign,look
AUTHOR
EXTENSIONS
More terms from Henry Bottomley, May 16 2001
Added a(0) from Michael Somos, Jan 08 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 25 10:34 EDT 2024. Contains 371967 sequences. (Running on oeis4.)