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

%I #33 Feb 18 2022 11:01:39

%S -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,

%T 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,

%U 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

%N a(2n+1) = |a(2n) - a(2n-1)|, a(2n) = a(n) + a(n-1), a(0) = -1.

%C 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

%C a(A153893(n)) = 0. - _Reinhard Zumkeller_, Mar 13 2011

%H Seiichi Manyama, <a href="/A020944/b020944.txt">Table of n, a(n) for n = 0..12287</a>

%H Roland Bacher, <a href="http://arxiv.org/abs/1005.5627">Twisting the Stern sequence</a>, arXiv:1005.5627v1 [math.CO], 2010.

%H Michael Coons, <a href="http://arxiv.org/abs/1008.0193">On Some Conjectures concerning Stern's Sequence and its Twist</a>, arXiv:1008.0193v3 [math.NT], 2010.

%F G.f. A(x) satisfies: A(x) = 2*x + (1 + x + x^2) * A(x^2). - _Michael Somos_, Jan 08 2011

%e 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 + ...

%t 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 *)

%o (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 */

%o (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 */

%o (Haskell)

%o a020944 n = a020944_list !! n

%o a020944_list = -1 : f [1,0] where f (x:y:xs) = x : f (y:xs ++ [x,x+y])

%o -- Same list generator function as for a020951_list, cf. A020951.

%o -- _Reinhard Zumkeller_, Mar 13 2013

%Y Cf. A020947, A020948, A020949, A020950, A153893.

%K sign,look

%O 0,9

%A _Clark Kimberling_

%E More terms from _Henry Bottomley_, May 16 2001

%E Added a(0) from _Michael Somos_, Jan 08 2011

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 March 28 05:39 EDT 2024. Contains 371235 sequences. (Running on oeis4.)