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.

This page as a plain text file.
%I A059841 #198 Aug 25 2025 19:27:51
%S A059841 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,
%T A059841 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,
%U A059841 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
%N A059841 Period 2: Repeat [1,0]. a(n) = 1 - (n mod 2); Characteristic function of even numbers.
%C A059841 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).
%C A059841 This is the r=0 member of the r-family of sequences S_r(n) defined in A092184 where more information can be found.
%C A059841 Successive binomial transforms of this sequence: A011782, A007051, A007582, A081186, A081187, A081188, A081189, A081190, A060531, A081192.
%C A059841 Characteristic function of even numbers: a(A005843(n))=1, a(A005408(n))=0. - _Reinhard Zumkeller_, Sep 29 2008
%C A059841 This sequence is the Euler transformation of A185012. - _Jason Kimberley_, Oct 14 2011
%C A059841 a(n) is the parity of n+1. - _Omar E. Pol_, Jan 17 2012
%C A059841 Read as partial sequences, we get to A000975. - _Jon Perry_, Nov 11 2014
%C A059841 Elementary Cellular Automata rule 77 produces this sequence.  See Wolfram, Weisstein and Index links below. - _Robert Price_, Jan 30 2016
%C A059841 Column k = 1 of A051159. - _John Keith_, Jun 28 2021
%C A059841 When read as a constant: decimal expansion of 10/99, binary expansion of 2/3. - _Jason Bard_, Aug 25 2025
%H A059841 Alois P. Heinz, <a href="/A059841/b059841.txt">Table of n, a(n) for n = 0..1000</a>
%H A059841 Paul Barry, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL8/Barry/barry84.html">A Catalan Transform and Related Transformations on Integer Sequences</a>, Journal of Integer Sequences, Vol. 8 (2005), Article 05.4.5.
%H A059841 Paul Barry, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL26/Barry/barry601.html">On Motzkin-Schröder Paths, Riordan Arrays, and Somos-4 Sequences</a>, J. Int. Seq. (2023) Vol. 26, Art. 23.4.7.
%H A059841 Atsuto Seko, Atsushi Togo, and Isao Tanaka, <a href="https://arxiv.org/abs/1901.02118">Group-theoretical high-order rotational invariants for structural representations: Application to linearized machine learning interatomic potential</a>, arXiv:1901.02118 [physics.comp-ph], 2019.
%H A059841 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/ElementaryCellularAutomaton.html">Elementary Cellular Automaton</a>
%H A059841 S. Wolfram, <a href="http://wolframscience.com/">A New Kind of Science</a>
%H A059841 <a href="/index/Ce#cell">Index entries for sequences related to cellular automata</a>
%H A059841 <a href="https://oeis.org/wiki/Index_to_Elementary_Cellular_Automata">Index to Elementary Cellular Automata</a>
%H A059841 <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,1).
%H A059841 <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F A059841 a(n) = 1 - A000035(n). - _M. F. Hasler_, Jan 13 2012
%F A059841 From _Paul Barry_, Mar 11 2003: (Start)
%F A059841 G.f.: 1/(1-x^2).
%F A059841 E.g.f.: cosh(x).
%F A059841 a(n) = (n+1) mod 2.
%F A059841 a(n) = 1/2 + (-1)^n/2. (End)
%F A059841 Additive with a(p^e) = 1 if p = 2, 0 otherwise.
%F A059841 a(n) = Sum_{k=0..n} (-1)^k*A038137(n, k). - _Philippe Deléham_, Nov 30 2006
%F A059841 a(n) = Sum_{k=1..n} (-1)^(n-k) for n > 0. - _William A. Tedeschi_, Aug 05 2011
%F A059841 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
%F A059841 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
%F A059841 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
%F A059841 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
%F A059841 a(n) = A000035(n+1) = A008619(n) - A110654(n). - _Wesley Ivan Hurt_, Jul 20 2013
%e A059841 Triangle begins:
%e A059841   1;
%e A059841   0, 1;
%e A059841   0, 1, 0;
%e A059841   1, 0, 1, 0;
%e A059841   1, 0, 1, 0, 1;
%e A059841   0, 1, 0, 1, 0, 1;
%e A059841   0, 1, 0, 1, 0, 1, 0;
%e A059841   1, 0, 1, 0, 1, 0, 1, 0;
%e A059841   1, 0, 1, 0, 1, 0, 1, 0, 1;
%e A059841   0, 1, 0, 1, 0, 1, 0, 1, 0, 1;
%e A059841   0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0;
%e A059841   ...
%p A059841 seq(1-modp(n,2), n=0..150); # _Muniru A Asiru_, Apr 05 2018
%t A059841 CoefficientList[Series[1/(1 - x^2), {x, 0, 104}], x] (* or *)
%t A059841 Array[1/2 + (-1)^#/2 &, 105, 0] (* _Michael De Vlieger_, Feb 19 2019 *)
%t A059841 Table[QBinomial[n, 1, -1], {n, 1, 74}] (* _John Keith_, Jun 28 2021 *)
%t A059841 PadRight[{},120,{1,0}] (* _Harvey P. Dale_, Mar 06 2023 *)
%o A059841 (PARI) a(n)=(n+1)%2; \\ or 1-n%2 as in NAME.
%o A059841 (PARI) A059841(n)=!bittest(n,0) \\ _M. F. Hasler_, Jan 13 2012
%o A059841 (Haskell)
%o A059841 a059841 n = (1 -) . (`mod` 2)
%o A059841 a059841_list = cycle [1,0]
%o A059841 -- _Reinhard Zumkeller_, May 05 2012, Dec 30 2011
%o A059841 (Magma) [0^(n mod 2): n in  [0..100]]; // _Vincenzo Librandi_, Nov 09 2014
%o A059841 (Python)
%o A059841 def A059841(n): return 1 - (n & 1) # _Chai Wah Wu_, May 25 2022
%Y A059841 One's complement of A000035 (essentially the same, but shifted once).
%Y A059841 Cf. A033999 (first differences), A008619 (partial sums), A004525, A011782 (binomial transf.), A000975.
%Y A059841 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).
%K A059841 easy,nonn,changed
%O A059841 0,1
%A A059841 _Alford Arnold_, Feb 25 2001
%E A059841 Better definition from _M. F. Hasler_, Jan 13 2012
%E A059841 _Reinhard Zumkeller_'s Sep 29 2008 description added as a secondary name by _Antti Karttunen_, May 03 2022