%I #118 Feb 08 2024 01:41:59
%S 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,
%T 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,
%U 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
%N Period 4: repeat [1, 1, 0, 0].
%C Partial sums of A056594.
%C Let i=sqrt(-1) and S(n) = Sum_{k=0..n-1} exp(2*Pi*i*k^2/n) for n>=1 the famous Gauss sum. Then S(n) = (a(n)+a(n+1)*i)*sqrt(n). - _Franz Vrabec_, Nov 08 2007
%C a(A042948(n)) = 1; a(A042964(n)) = 0. - _Reinhard Zumkeller_, Oct 03 2008
%C a(n) is also the real part of partial sum of powers of the complex unit i. - _Enrique Pérez Herrero_, Aug 16 2009
%C Periodic sequences having a period of 2k and composed of k ones followed by k zeros have a closed formula of floor(((n+k) mod 2k)/k). Listed sequences of this form are: k=1..A000035(n+1), k=2..A133872(n), k=3..A088911, k=4..A131078(n), k=5..A112713(n-1). - _Gary Detlefs_, May 17 2011
%C 0.repeat(0,0,1,1) is 1/5 in base 2, due to 1/5 = (3/16)/(1-1/16). For the general case see 1/A062158(n) in base n >= 2. Here n = 2. - _Wolfdieter Lang_, Jun 20 2014
%C a(n) (for n>=1) is the determinant of the n X n Toeplitz matrix M satisfying: M(i,j)=1 if -1<=j-i<=2 and 0 otherwise. - _Dmitry Efimov_, Jun 23 2015
%C a(n) (for n>=1) is the difference between numbers of even and odd permutations p of 1,2,...,n such that -1 <= p(i)-i <= 2 for i=1,2,...,n. - _Dmitry Efimov_, Jan 08 2016
%C The binomial transform is 1, 2, 3, 4, 6, 12,... (see A038504). - _R. J. Mathar_, Feb 25 2023
%H Michael De Vlieger, <a href="/A133872/b133872.txt">Table of n, a(n) for n = 0..10000</a>
%H Clark Kimberling, <a href="https://www.emis.de/journals/JIS/VOL22/Kimberling/kimb9.html">A Combinatorial Classification of Triangle Centers on the Line at Infinity</a>, J. Int. Seq., Vol. 22 (2019), Article 19.5.4.
%H Psychedelic Geometry Blogspot, <a href="http://psychedelic-geometry.blogspot.com/2009/08/curious-series-001.html">Curious Series-001</a> [_Enrique Pérez Herrero_, Aug 16 2009]
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1).
%F a(n) = (1 + floor(n/2)) mod 2.
%F a(n) = A004526(A000035(n+2)).
%F a(n) = 1 + floor(n/2) - 2*floor((n+2)/4).
%F a(n) = (((n+2) mod 4) - (n mod 2))/2.
%F a(n) = ((n + 2 - (n mod 2))/2) mod 2.
%F a(n) = ((2*n + 3 + (-1)^n)/4) mod 2.
%F a(n) = (1 + (-1)^((2*n - 1 + (-1)^n)/4))/2.
%F a(n) = binomial(n+2, n) mod 2 = binomial(n+2, 2) mod 2.
%F a(n) = A000217(n+1) mod 2.
%F G.f.: (1+x)/(1-x^4) = 1/((1-x)(1+x^2)).
%F a(n) = 1/2 + (1/2)*cos(Pi*n/2) + (1/2)*sin(Pi*n/2). a(n) = A021913(n+2). - _R. J. Mathar_, Nov 15 2007
%F From _Jaume Oliver Lafont_, Dec 05 2008: (Start)
%F a(n) = 1/2 + sin((2n+1)Pi/4)/sqrt(2).
%F a(n) = 1/2 + cos((2n-1)Pi/4)/sqrt(2). (End)
%F a(n) = Re(Sum_{k=0..n} i^k), where i=sqrt(-1) and Re is the real part of a complex number. a(n) = (1/2)*((Sum_{k=0..n} i^k) + Sum_{k=0..n} i^-k) = Re((1/2)*(1 + i)*(1 - i^(n+1))). - _Enrique Pérez Herrero_, Aug 16 2009
%F a(n) = (1 + i^(n*(n-1)))/2, where i=sqrt(-1). - _Bruno Berselli_, May 18 2011
%F a(n) = (Sum_{k=1..n} k^j) mod 2, for any j. - _Gary Detlefs_, Dec 28 2011
%F a(n) = a(n-1) - a(n-2) + a(n-3) for n>2. - _Jean-Christophe Hervé_, May 01 2013
%F a(n) = 1 - floor(n/2) + 2*floor(n/4) = 1 - A004526(n) + A122461(n). - _Wesley Ivan Hurt_, Dec 06 2013
%F a(n) = (1 + (-1)^floor(n/2))/2. - _Wesley Ivan Hurt_, Apr 17 2014
%F a(n) = A054925(n+2) - A011848(n+2). - _Wesley Ivan Hurt_, Jun 09 2014
%F Euler transform of length 4 sequence [1, -1, 0, 1]. - _Michael Somos_, Sep 26 2014
%F a(n) = a(1-n) for all n in Z. - _Michael Somos_, Sep 26 2014
%F From _Ilya Gutkovskiy_, Jul 09 2016: (Start)
%F Inverse binomial transform of A038504(n+1).
%F E.g.f.: (exp(x) + sin(x) + cos(x))/2. (End)
%F a(n) = (1 + (-1)^(n*(n-1)/2))/2. - _Guenther Schrack_, Apr 04 2019
%e G.f. = 1 + x + x^4 + x^5 + x^8 + x^9 + x^12 + x^13 + x^16 + x^17 + x^20 + ...
%p A133872:=n->(1+(-1)^((2n-1+(-1)^n)/4))/2;
%p seq(A133872(n), n=0..100); # _Wesley Ivan Hurt_, Dec 06 2013
%t Table[(1 + (-1)^((2 n - 1 + (-1)^n)/4))/2, {n, 0, 100}] (* _Wesley Ivan Hurt_, Dec 06 2013 *)
%t PadRight[{},120,{1,1,0,0}] (* _Harvey P. Dale_, Jan 26 2014 *)
%o (PARI) a(n)=n%4<2 \\ _Jaume Oliver Lafont_, Mar 17 2009
%o (Magma) [ (1 + (-1)^Floor(n/2))/2 : n in [0..50] ]; // _Wesley Ivan Hurt_, Jun 09 2014
%o (PARI) Vec((1+x)/(1-x^4) + O(x^100)) \\ _Altug Alkan_, Jan 08 2015
%o (Magma) &cat[[1,1,0,0]^^25]; // _Vincenzo Librandi_, Jan 09 2016
%o (R)
%o maxn <- 63 # by choice
%o a <- c(1,0,0)
%o for(n in 4:maxn) a[n] <- a[n-1] - a[n-2] + a[n-3]
%o (a <- a(1,a))
%o # _Yosu Yurramendi_, Oct 25 2020
%o (Python)
%o def A133872(n): return int(not n&2) # _Chai Wah Wu_, Jan 31 2023
%Y Cf. A056594, A133620-A133625, A133630, A038509, A133634-A133636, A021913, A000217, A133882, A133880, A133890, A133900, A133910, A000035, A088911, A131078, A112713.
%K nonn,easy
%O 0,1
%A _Hieronymus Fischer_, Oct 10 2007
%E Definition rewritten by _N. J. A. Sloane_, Apr 30 2009
|