%I #194 Dec 14 2023 05:25:32
%S 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 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 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
%N Period 2: Repeat [1,0]. a(n) = 1 - (n mod 2); Characteristic function of even numbers.
%C 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 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 Successive binomial transforms of this sequence: A011782, A007051, A007582, A081186, A081187, A081188, A081189, A081190, A060531, A081192.
%C Characteristic function of even numbers: a(A005843(n))=1, a(A005408(n))=0. - _Reinhard Zumkeller_, Sep 29 2008
%C This sequence is the Euler transformation of A185012. - _Jason Kimberley_, Oct 14 2011
%C a(n) is the parity of n+1. - _Omar E. Pol_, Jan 17 2012
%C Read as partial sequences, we get to A000975. - _Jon Perry_, Nov 11 2014
%C Elementary Cellular Automata rule 77 produces this sequence. See Wolfram, Weisstein and Index links below. - _Robert Price_, Jan 30 2016
%C Column k = 1 of A051159. - _John Keith_, Jun 28 2021
%H Alois P. Heinz, <a href="/A059841/b059841.txt">Table of n, a(n) for n = 0..1000</a>
%H 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 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 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 Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ElementaryCellularAutomaton.html">Elementary Cellular Automaton</a>
%H S. Wolfram, <a href="http://wolframscience.com/">A New Kind of Science</a>
%H <a href="/index/Ce#cell">Index entries for sequences related to cellular automata</a>
%H <a href="https://oeis.org/wiki/Index_to_Elementary_Cellular_Automata">Index to Elementary Cellular Automata</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,1).
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F a(n) = 1 - A000035(n). - _M. F. Hasler_, Jan 13 2012
%F From _Paul Barry_, Mar 11 2003: (Start)
%F G.f.: 1/(1-x^2).
%F E.g.f.: cosh(x).
%F a(n) = (n+1) mod 2.
%F a(n) = 1/2 + (-1)^n/2. (End)
%F Additive with a(p^e) = 1 if p = 2, 0 otherwise.
%F a(n) = Sum_{k=0..n} (-1)^k*A038137(n, k). - _Philippe Deléham_, Nov 30 2006
%F a(n) = Sum_{k=1..n} (-1)^(n-k) for n > 0. - _William A. Tedeschi_, Aug 05 2011
%F 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 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 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 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 a(n) = A000035(n+1) = A008619(n) - A110654(n). - _Wesley Ivan Hurt_, Jul 20 2013
%e Triangle begins:
%e 1;
%e 0, 1;
%e 0, 1, 0;
%e 1, 0, 1, 0;
%e 1, 0, 1, 0, 1;
%e 0, 1, 0, 1, 0, 1;
%e 0, 1, 0, 1, 0, 1, 0;
%e 1, 0, 1, 0, 1, 0, 1, 0;
%e 1, 0, 1, 0, 1, 0, 1, 0, 1;
%e 0, 1, 0, 1, 0, 1, 0, 1, 0, 1;
%e 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0;
%e ...
%p seq(1-modp(n,2), n=0..150); # _Muniru A Asiru_, Apr 05 2018
%t CoefficientList[Series[1/(1 - x^2), {x, 0, 104}], x] (* or *)
%t Array[1/2 + (-1)^#/2 &, 105, 0] (* _Michael De Vlieger_, Feb 19 2019 *)
%t Table[QBinomial[n, 1, -1], {n, 1, 74}] (* _John Keith_, Jun 28 2021 *)
%t PadRight[{},120,{1,0}] (* _Harvey P. Dale_, Mar 06 2023 *)
%o (PARI) a(n)=(n+1)%2; \\ or 1-n%2 as in NAME.
%o (PARI) A059841(n)=!bittest(n,0) \\ _M. F. Hasler_, Jan 13 2012
%o (Haskell)
%o a059841 n = (1 -) . (`mod` 2)
%o a059841_list = cycle [1,0]
%o -- _Reinhard Zumkeller_, May 05 2012, Dec 30 2011
%o (Magma) [0^(n mod 2): n in [0..100]]; // _Vincenzo Librandi_, Nov 09 2014
%o (Python)
%o def A059841(n): return 1 - (n & 1) # _Chai Wah Wu_, May 25 2022
%Y One's complement of A000035 (essentially the same, but shifted once).
%Y Cf. A033999 (first differences), A008619 (partial sums), A004525, A011782 (binomial transf.), A000975.
%Y 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 easy,nonn
%O 0,1
%A _Alford Arnold_, Feb 25 2001
%E Better definition from _M. F. Hasler_, Jan 13 2012
%E _Reinhard Zumkeller_'s Sep 29 2008 description added as a secondary name by _Antti Karttunen_, May 03 2022