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
Seiichi Manyama, Table of n, a(n) for n = 0..12287
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
KEYWORD
sign,look
AUTHOR
EXTENSIONS
More terms from Henry Bottomley, May 16 2001
Added a(0) from Michael Somos, Jan 08 2011
STATUS
approved