cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A020944 #33 Feb 18 2022 11:01:39
%S A020944 -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 A020944 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 A020944 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 A020944 a(2n+1) = |a(2n) - a(2n-1)|, a(2n) = a(n) + a(n-1), a(0) = -1.
%C A020944 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 A020944 a(A153893(n)) = 0. - _Reinhard Zumkeller_, Mar 13 2011
%H A020944 Seiichi Manyama, <a href="/A020944/b020944.txt">Table of n, a(n) for n = 0..12287</a>
%H A020944 Roland Bacher, <a href="http://arxiv.org/abs/1005.5627">Twisting the Stern sequence</a>, arXiv:1005.5627v1 [math.CO], 2010.
%H A020944 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 A020944 G.f. A(x) satisfies: A(x) = 2*x + (1 + x + x^2) * A(x^2). - _Michael Somos_, Jan 08 2011
%e A020944 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 A020944 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 A020944 (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 A020944 (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 A020944 (Haskell)
%o A020944 a020944 n = a020944_list !! n
%o A020944 a020944_list = -1 : f [1,0] where f (x:y:xs) = x : f (y:xs ++ [x,x+y])
%o A020944 -- Same list generator function as for a020951_list, cf. A020951.
%o A020944 -- _Reinhard Zumkeller_, Mar 13 2013
%Y A020944 Cf. A020947, A020948, A020949, A020950, A153893.
%K A020944 sign,look
%O A020944 0,9
%A A020944 _Clark Kimberling_
%E A020944 More terms from _Henry Bottomley_, May 16 2001
%E A020944 Added a(0) from _Michael Somos_, Jan 08 2011