login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A005590
a(0) = 0, a(1) = 1, a(2n) = a(n), a(2n+1) = a(n+1) - a(n).
(Formerly M0048)
34
0, 1, 1, 0, 1, -1, 0, 1, 1, -2, -1, 1, 0, 1, 1, 0, 1, -3, -2, 1, -1, 2, 1, -1, 0, 1, 1, 0, 1, -1, 0, 1, 1, -4, -3, 1, -2, 3, 1, -2, -1, 3, 2, -1, 1, -2, -1, 1, 0, 1, 1, 0, 1, -1, 0, 1, 1, -2, -1, 1, 0, 1, 1, 0, 1, -5, -4, 1, -3, 4, 1, -3, -2, 5, 3, -2, 1, -3, -2, 1, -1, 4, 3, -1, 2, -3, -1, 2, 1, -3, -2, 1, -1, 2, 1, -1, 0, 1, 1, 0, 1, -1, 0, 1, 1
OFFSET
0,10
COMMENTS
If "-" in the definition is changed to "+", we get Stern's diatomic sequence A002487.
Sequence is 2-regular.
Let M = a triangular matrix with (1, 1, -1, 0, 0, 0, ...) in every column >k=1 shifted down twice from the previous column. Then A005590 starting with 1 = lim_{n->infinity} M^n, the left-shifted vector considered as a sequence. - Gary W. Adamson, Apr 13 2010
a(A001969(n)) <= 0; a(A000069(n)) > 0. - Reinhard Zumkeller, Apr 11 2012
REFERENCES
B. Reznick, A new sequence with many properties, Abstract 809-10-185, Abstracts Amer. Math. Soc., 5 (1984), p. 16. [See link below]
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
J.-P. Allouche and M. Mendes France, Stern-Brocot polynomials and power series, arXiv preprint arXiv:1202.0211 [math.NT], 2012.
J.-P. Allouche and J. Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197.
Bruce Reznick, Some extremal problems for continued fractions, Ill. J. Math., 29 (1985), 261-279.
Bruce Reznick, Letter to N. J. A. Sloane, Jun 03 1991; also annotated scanned copy of B. Reznick, A new sequence with many properties, Abstract 809-10-185, Abstracts Amer. Math. Soc., 5 (1984), p. 16.
Ralf Stephan, Divide-and-conquer generating functions. I. Elementary sequences, arXiv:math/0307027 [math.CO], 2003.
FORMULA
G.f.: x*Product_{k>=0} (1+x^(2^k) - x^2^(k+1)). - Ralf Stephan, Apr 26 2003
Conjecture: a(3n)=0 iff n in A003714. - Ralf Stephan, May 02 2003
a(n) = Sum_{k=0..n-1} (-1)^A010060(n-k-1)*(binomial(k, n-k-1) mod 2). - Paul Barry, Mar 26 2005
G.f. satisfies A(x) = (1 + 1/x - x) * A(x^2). - Michael Somos, Sep 17 2003
limsup log(|a(n)|)/(log n) = 0.4309... [Reznick] - N. J. A. Sloane, Jul 23 2016
From Chai Wah Wu, Dec 20 2016: (Start)
a(2^k*n+1) = a(n+1) - k*a(n);
a(2^k*n+3) = a(n) for k >= 2;
a(2^k*n+5) = -a(2^(k-1)*n+1) for k >= 3;
a(2^k*n+7) = a(2^(k-2)*n+1) for k >= 4;
a(2^k*n+2^k-1) = a(n) if k is even;
a(2^k*n+2^k-1) = a(n+1)-a(n)= a(2*n+1) if k is odd.
This implies that
a(2^k+1) = 1-k;
a(2^k+3) = 1 for k >= 2;
a(2^k+5) = k-2 for k >= 3;
a(2^k+7) = 3-k for k >= 4;
a(2^k-1) = 0 if k is even;
a(2^k-1) = 1 if k is odd.
(End)
EXAMPLE
G.f. = x + x^2 + x^4 - x^5 + x^7 + x^8 - 2*x^9 - x^10 + x^12 + x^13 + x^14 + ...
MAPLE
A005590 := proc(n) option remember; if n <= 1 then n; elif n mod 2 = 0 then A005590(n/2); else A005590((n+1)/2)-A005590((n-1)/2); fi; end;
MATHEMATICA
a[0] = 0; a[1] = 1; a[n_] := a[n] = If[OddQ[n], a[(n-1)/2 + 1] - a[(n-1)/2], a[n/2]]; Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Nov 27 2012 *)
PROG
(PARI) {a(n) = if( n<=1, n>0, if(n%2, a(n\2+1) - a(n\2), a(n/2)))}; /* Michael Somos, Sep 17 2003 */
(Haskell)
import Data.List (transpose)
a005590 n = a005590_list !! n
a005590_list = 0 : 1 : concat (tail $ transpose
[a005590_list, zipWith (-) (tail a005590_list) a005590_list])
-- Reinhard Zumkeller, Apr 11 2012
(Python)
l=[0, 1]
for n in range(2, 101):
l.append(l[n//2] if n%2==0 else l[(n + 1)//2] - l[(n - 1)//2])
print(l) # Indranil Ghosh, Jun 28 2017
CROSSREFS
Cf. A002487, A182093 (partial sums).
Sequence in context: A076453 A263657 A261769 * A142598 A274372 A037800
KEYWORD
sign,nice,easy,look
EXTENSIONS
More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Mar 28 2003
Signs corrected by Ralf Stephan, Apr 26 2003
STATUS
approved