%I #190 Dec 14 2023 05:26:05
%S 1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,
%T 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,
%U 0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0
%N Characteristic function of multiples of three.
%C Period 3: repeat [1, 0, 0].
%C a(n)=1 if n=3k, a(n)=0 otherwise.
%C Decimal expansion of 1/999.
%C Number of permutations satisfying -k <= p(i)-i <= r and p(i)-i not in I, i=1..n, with k=1, r=2, I={0,1}.
%C a(n) is also the number of partitions of n with every part being three (a(0)=1 because the empty partition has no parts). Hence a(n) is also the number of 2-regular graphs on n vertices with each component having girth 3. - _Jason Kimberley_, Oct 02 2011
%C Euler transformation of A185013. - _Jason Kimberley_, Oct 02 2011
%C If b(0)=0 and for n > 0, b(n)=a(n), then starting at n=0, b(n) is the number of incongruent equilateral triangles formed from the vertices of a regular n-gon. The number of incongruent isosceles triangles (strictly two equal sides) is A174257(n) and the number of incongruent scalene triangles is A069905(n-3) for n > 2, otherwise 0. The total number of incongruent triangles is A069905(n). - _Frank M Jackson_, Nov 19 2022
%D D. H. Lehmer, Permutations with strongly restricted displacements. Combinatorial theory and its applications, II (Proc. Colloq., Balatonfured, 1969), pp. 755-770. North-Holland, Amsterdam, 1970.
%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 Vol. 4, No 1 (2010), 119-135.
%H N. Gogin and A. Mylläri, <a href="http://math.unm.edu/~aca/ACA/2013/Nonstandard/Gogin.pdf">Padovan-like sequences and Bell polynomials</a>, Proceedings of Applications of Computer Algebra ACA, 2013.
%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 <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 (0,0,1).
%F a(n) = a(n-3) for n > 2.
%F G.f.: 1/(1-x^3) = 1/( (1-x)*(1+x+x^2)).
%F a(n) = (1 + e^(i*Pi*A002487(n)))/2, i=sqrt(-1). - _Paul Barry_, Jan 14 2005
%F Additive with a(p^e) = 1 if p = 3, 0 otherwise.
%F a(n) = ((n+1) mod 3) mod 2. Also: a(n) = (1/2)*(1 + (-1)^(n + floor((n+1)/3))). - _Hieronymus Fischer_, May 29 2007
%F a(n) = 1 - A011655(n). - _Reinhard Zumkeller_, Nov 30 2009
%F a(n) = (1 + (-1)^(2*n/3) + (-1)^(-2*n/3))/3. - _Jaume Oliver Lafont_, May 13 2010
%F For the general case: the characteristic function of numbers that are multiples of m is a(n) = floor(n/m) - floor((n-1)/m), m,n > 0. - _Boris Putievskiy_, May 08 2013
%F a(n) = floor( ((n-1) mod 3)/2 ). - _Wesley Ivan Hurt_, Jun 29 2013
%F a(n) = 2^(n mod 3) mod 2. - _Olivier Gérard_, Jul 04 2013
%F a(n) = (w^(2*n) + w^n + 1)/3, w = (-1 + i*sqrt(3))/2 (w is a primitive 3rd root of unity). - _Bogart B. Strauss_, Jul 20 2013
%F E.g.f.: (exp(x) + 2*exp(-x/2)*cos(sqrt(3)*x/2))/3. - _Geoffrey Critzer_, Nov 03 2014
%F a(n) = (sin(Pi*(n+1)/3)^2)*(2/3) + sin(Pi*(n+1)*2/3)/sqrt(3). - _Mikael Aaltonen_, Jan 03 2015
%F a(n) = (2*n^2 + 1) mod 3. The characteristic function of numbers that are multiples of 2k+1 is (2*k*n^(2*k) + 1) mod (2k+1). Example: A058331(n) mod 3 for k=1, A211412(n) mod 5 for k=2, ... - _Eric Desbiaux_, Dec 25 2015
%F a(n) = floor(2*(n-1)/3) - 2*floor((n-1)/3). - _Wesley Ivan Hurt_, Jul 25 2016
%F a(n) == A007908(n+1) (mod 3), n >= 0. See A011655 (bit flipped). - _Wolfdieter Lang_, Jun 12 2017
%F a(n) = 1/3 + (2/3)*cos((2/3)*n*Pi). - _Ridouane Oudra_, Jan 22 2021
%p seq(op([1, 0, 0]), n=0..50); # _Wesley Ivan Hurt_, Jun 30 2016
%t Table[Boole[IntegerQ[n/3]], {n, 0, 127}] (* _Michael De Vlieger_, Jan 03 2015, after _Alonso del Arte_ at A121262 *)
%o (PARI) a(n)=!(n%3) \\ _Jaume Oliver Lafont_, Mar 01 2009
%o (Haskell)
%o a079978 = fromEnum . (== 0) . (`mod` 3)
%o a079978_list = cycle [1,0,0]
%o -- _Reinhard Zumkeller_, Aug 28 2012, Nov 26 2011
%o (Magma) &cat[[1,0,0]^^30]; // _Vincenzo Librandi_, Dec 26 2015
%Y Cf. A002524-A002529, A072827, A072850-A072856, A079955-A080014.
%Y Essentially the same as A022003.
%Y Partial sums are given by A002264(n+3).
%Y Characteristic function of multiples of g: A000007 (g=0), A000012 (g=1), A059841 (g=2), this sequence (g=3), A121262 (g=4), A079998 (g=5), A079979 (g=6), A082784 (g=7). - _Jason Kimberley_, Oct 14 2011
%Y Cf. A007908, A011655 (bit flipped).
%K nonn,easy
%O 0,1
%A _Vladimir Baltic_, Feb 17 2003
%E Name simplified by _Ralf Stephan_, Nov 22 2010
%E Name changed by _Jason Kimberley_, Oct 14 2011