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.

A059841 Period 2: Repeat [1,0]. a(n) = 1 - (n mod 2); Characteristic function of even numbers.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
Offset: 0

Views

Author

Alford Arnold, Feb 25 2001

Keywords

Comments

When viewed as a triangular array, the row sum values are 0 1 1 1 2 3 3 3 4 5 5 5 6 ... (A004525).
This is the r=0 member of the r-family of sequences S_r(n) defined in A092184 where more information can be found.
Successive binomial transforms of this sequence: A011782, A007051, A007582, A081186, A081187, A081188, A081189, A081190, A060531, A081192.
Characteristic function of even numbers: a(A005843(n))=1, a(A005408(n))=0. - Reinhard Zumkeller, Sep 29 2008
This sequence is the Euler transformation of A185012. - Jason Kimberley, Oct 14 2011
a(n) is the parity of n+1. - Omar E. Pol, Jan 17 2012
Read as partial sequences, we get to A000975. - Jon Perry, Nov 11 2014
Elementary Cellular Automata rule 77 produces this sequence. See Wolfram, Weisstein and Index links below. - Robert Price, Jan 30 2016
Column k = 1 of A051159. - John Keith, Jun 28 2021
When read as a constant: decimal expansion of 10/99, binary expansion of 2/3. - Jason Bard, Aug 25 2025

Examples

			Triangle begins:
  1;
  0, 1;
  0, 1, 0;
  1, 0, 1, 0;
  1, 0, 1, 0, 1;
  0, 1, 0, 1, 0, 1;
  0, 1, 0, 1, 0, 1, 0;
  1, 0, 1, 0, 1, 0, 1, 0;
  1, 0, 1, 0, 1, 0, 1, 0, 1;
  0, 1, 0, 1, 0, 1, 0, 1, 0, 1;
  0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0;
  ...
		

Crossrefs

One's complement of A000035 (essentially the same, but shifted once).
Cf. A033999 (first differences), A008619 (partial sums), A004525, A011782 (binomial transf.), A000975.
Characteristic function of multiples of g: A000007 (g=0), A000012 (g=1), this sequence (g=2), A079978 (g=3), A121262 (g=4), A079998 (g=5), A079979 (g=6), A082784 (g=7).

Programs

  • Haskell
    a059841 n = (1 -) . (`mod` 2)
    a059841_list = cycle [1,0]
    -- Reinhard Zumkeller, May 05 2012, Dec 30 2011
    
  • Magma
    [0^(n mod 2): n in  [0..100]]; // Vincenzo Librandi, Nov 09 2014
    
  • Maple
    seq(1-modp(n,2), n=0..150); # Muniru A Asiru, Apr 05 2018
  • Mathematica
    CoefficientList[Series[1/(1 - x^2), {x, 0, 104}], x] (* or *)
    Array[1/2 + (-1)^#/2 &, 105, 0] (* Michael De Vlieger, Feb 19 2019 *)
    Table[QBinomial[n, 1, -1], {n, 1, 74}] (* John Keith, Jun 28 2021 *)
    PadRight[{},120,{1,0}] (* Harvey P. Dale, Mar 06 2023 *)
  • PARI
    a(n)=(n+1)%2; \\ or 1-n%2 as in NAME.
    
  • PARI
    A059841(n)=!bittest(n,0) \\ M. F. Hasler, Jan 13 2012
    
  • Python
    def A059841(n): return 1 - (n & 1) # Chai Wah Wu, May 25 2022

Formula

a(n) = 1 - A000035(n). - M. F. Hasler, Jan 13 2012
From Paul Barry, Mar 11 2003: (Start)
G.f.: 1/(1-x^2).
E.g.f.: cosh(x).
a(n) = (n+1) mod 2.
a(n) = 1/2 + (-1)^n/2. (End)
Additive with a(p^e) = 1 if p = 2, 0 otherwise.
a(n) = Sum_{k=0..n} (-1)^k*A038137(n, k). - Philippe Deléham, Nov 30 2006
a(n) = Sum_{k=1..n} (-1)^(n-k) for n > 0. - William A. Tedeschi, Aug 05 2011
E.g.f.: cosh(x) = 1 + x^2/(Q(0) - x^2); Q(k) = 8k + 2 + x^2/(1 + (2k + 1)*(2k + 2)/Q(k + 1)); (continued fraction). - Sergei N. Gladkovskii, Nov 21 2011
E.g.f.: cosh(x) = 1/2*Q(0); Q(k) = 1 + 1/(1 - x^2/(x^2 + (2k + 1)*(2k + 2)/Q(k + 1))); (continued fraction). - Sergei N. Gladkovskii, Nov 21 2011
E.g.f.: cosh(x) = E(0)/(1-x) where E(k) = 1 - x/(1 - x/(x - (2*k+1)*(2*k+2)/E(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Apr 05 2013
For the general case: the characteristic function of numbers that are not multiples of m is a(n) = floor((n-1)/m) - floor(n/m) + 1, m,n > 0. - Boris Putievskiy, May 08 2013
a(n) = A000035(n+1) = A008619(n) - A110654(n). - Wesley Ivan Hurt, Jul 20 2013

Extensions

Better definition from M. F. Hasler, Jan 13 2012
Reinhard Zumkeller's Sep 29 2008 description added as a secondary name by Antti Karttunen, May 03 2022