%I #118 Dec 14 2023 05:26:45
%S 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,
%T 0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,
%U 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0
%N The characteristic function of the multiples of four.
%C Period 4: repeat [1, 0, 0, 0].
%C a(n) is also the number of partitions of n where each part is four (Since the empty partition has no parts, a(0) = 1). Hence a(n) is also the number of 2-regular graphs on n vertices such that each component has girth exactly four. - _Jason Kimberley_, Oct 01 2011
%C This sequence is the Euler transformation of A185014. - _Jason Kimberley_, Oct 01 2011
%C Number of permutations satisfying -k <= p(i) - i <= r and p(i)-i not in I, i = 1..n, with k = 1, r = 3, I = {0, 1, 2}. - _Vladimir Baltic_, Mar 07 2012
%D G. Balzarotti and P. P. Lava, Le sequenze di numeri interi, Hoepli, 2008, p. 82.
%H Antti Karttunen, <a href="/A121262/b121262.txt">Table of n, a(n) for n = 0..65537</a>
%H Vladimir Baltic, <a href="http://pefmath.etf.rs/vol4num1/AADM-Vol4-No1-119-135.pdf">On the number of certain types of strongly restricted permutations</a>, Applicable Analysis and Discrete Mathematics 4 (2010), 119-135
%H Steve Chow, <a href="https://youtu.be/umH_AL6vQ9Y">0,0,0,1,0,0,0,1</a> (deriving an explicit formula for the sequence) :YouTube Video, 2017.
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,1).
%F a(n) = (1/4)*(2*cos(n*Pi/2) + 1 + (-1)^n).
%F Additive with a(p^e) = 1 if p = 2 and e > 1, 0 otherwise.
%F Sequence shifted right by 2 is additive with a(p^e) = 1 if p = 2 and e = 1, 0 otherwise.
%F a(n) = 1 - (C(n + 1, n + (-1)^(n+1)) mod 2).
%F a(n) = 0^(n mod 4). - _Reinhard Zumkeller_, Sep 30 2008
%F a(n) = !(n%4). - _Jaume Oliver Lafont_, Mar 01 2009
%F a(n) = (1/4)*(1 + I^n + (-1)^n + (-I)^n). - _Paolo P. Lava_, May 04 2010
%F a(n) = ((n-1)^k mod 4 - (n-1)^(k-1) mod 4)/2, k > 2. - _Gary Detlefs_, Feb 21 2011
%F a(n) = floor(1/2*cos(n*Pi/2) + 1/2). - _Gary Detlefs_, May 16 2011
%F G.f.: 1/(1 - x^4); a(n) = (1 + (-1)^n)*(1 + i^((n-1)*n))/4, where i = sqrt(-1). - _Bruno Berselli_, Sep 28 2011
%F a(n) = floor(((n+3) mod 4)/3). - _Gary Detlefs_, Dec 29 2011
%F a(n) = floor(n/4) - floor((n-1)/4). - _Tani Akinari_, Oct 25 2012
%F a(n) = ceiling( (1/2)*cos(Pi*n/2) ). - _Wesley Ivan Hurt_, May 31 2013
%F a(n) = ((1+(-1)^(n/2))*(1+(-1)^n))/4. - _Bogart B. Strauss_, Jul 14 2013
%F a(n) = C(n-1,3) mod 2. - _Wesley Ivan Hurt_, Oct 07 2014
%F a(n) = (((n+1) mod 4) mod 3) mod 2. - _Ctibor O. Zizka_, Dec 11 2014
%F a(n) = (sin(Pi*(n+1)/2)^2)/2 + sin(Pi*(n+1)/2)/2. - _Mikael Aaltonen_, Jan 02 2015
%F E.g.f.: (cos(x) + cosh(x))/2. - _Vaclav Kotesovec_, Feb 15 2015
%F a(n) = a(n-4) for n>3. - _Wesley Ivan Hurt_, Jul 07 2016
%F a(n) = (1-sqrt(2)*cos(n*Pi/2-3*Pi/4))/2 * cos(n*Pi/2). - (found by Steve Chow) _Iain Fox_, Nov 16 2017
%F a(n) = 1-A166486(n). - _Antti Karttunen_, Jul 29 2018
%F a(n) = (1-(-1)^A142150(n+1))/2. - _Adriano Caroli_, Sep 28 2019
%p seq(op([1, 0, 0, 0]), n=0..50); # _Wesley Ivan Hurt_, Jul 07 2016
%t Table[Boole[IntegerQ[n/4]], {n,0,127}] (* _Alonso del Arte_, Jul 14 2013 *)
%o (Haskell)
%o a121262 = (0 ^) . flip mod 4 -- _Reinhard Zumkeller_, Mar 04 2015
%o a121262_list = cycle [1,0,0,0] -- _Reinhard Zumkeller_, Jan 06 2012
%o (PARI) a(n)=!(n%4) \\ _Charles R Greathouse IV_, Oct 25 2012
%o (Magma) &cat [[1, 0, 0, 0]^^30]; // _Wesley Ivan Hurt_, Jul 07 2016
%Y A011765 is another version of the same sequence.
%Y Characteristic function of multiples of g: A000007 (g=0), A000012 (g=1), A059841 (g=2), A079978 (g=3), this sequence (g=4), A079998 (g=5), A079979 (g=6), A082784 (g=7). - _Jason Kimberley_, Oct 14 2011
%Y Cf. A010873, A166486, A185014.
%K nonn,easy
%O 0,1
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Aug 23 2006, Aug 30 2007
%E More terms from _Antti Karttunen_, Jul 29 2018
|