A059841 Period 2: Repeat [1,0]. a(n) = 1 - (n mod 2); Characteristic function of even numbers.
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
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; ...
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Paul Barry, A Catalan Transform and Related Transformations on Integer Sequences, Journal of Integer Sequences, Vol. 8 (2005), Article 05.4.5.
- Paul Barry, On Motzkin-Schröder Paths, Riordan Arrays, and Somos-4 Sequences, J. Int. Seq. (2023) Vol. 26, Art. 23.4.7.
- Atsuto Seko, Atsushi Togo, and Isao Tanaka, Group-theoretical high-order rotational invariants for structural representations: Application to linearized machine learning interatomic potential, arXiv:1901.02118 [physics.comp-ph], 2019.
- Eric Weisstein's World of Mathematics, Elementary Cellular Automaton
- S. Wolfram, A New Kind of Science
- Index entries for sequences related to cellular automata
- Index to Elementary Cellular Automata
- Index entries for linear recurrences with constant coefficients, signature (0,1).
- Index entries for characteristic functions
Crossrefs
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
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
Comments