login
Period 3: repeat [0, 2, 1].
20

%I #61 Sep 08 2022 08:45:09

%S 0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,

%T 2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,

%U 1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1

%N Period 3: repeat [0, 2, 1].

%C Previous name was: Jacobsthal selector sequence.

%C The Jacobsthal sequence A001045 can be defined by A001045(n) = Sum_{k=0..floor(n,3)} C(n, a(n-1)+3*k).

%C The floor of the area under the polygon connecting the lattice points: (n, a(n)) from 0..n is A001477(n), the nonnegative integers. - _Wesley Ivan Hurt_, Jun 16 2014

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).

%F a(n) = ceiling(((n mod 3) + 1)/2) + (-1)^((n mod 3) + 1).

%F G.f.: x*(x+2)/(1-x^3). - _Paul Barry_, May 25 2003

%F a(n) = (3 - (n mod 3)) mod 3. - _Reinhard Zumkeller_, Jul 30 2005

%F a(n) = 2 * A001045(L(n/3)), where L(j/p) is the Legendre symbol of j and p.

%F a(n) = (-n) mod 3; also a(n) = 3*ceiling(n/3)-n. - _Hieronymus Fischer_, May 29 2007

%F a(n) = A130196(n) + A131534(n) - 2. - _Reinhard Zumkeller_, Nov 12 2009

%F a(n) = (2n) mod 3. - _Wesley Ivan Hurt_, Jun 23 2013

%F From _Wesley Ivan Hurt_, Jul 02 2016: (Start)

%F a(n) = a(n-3) for n>2.

%F a(n) = 2*sin(n*Pi/3)*(3*sin(n*Pi/3) + sqrt(3)*cos(n*Pi/3))/3. (End)

%p seq(modp(2*n,3), n=0..90); # _Zerinvary Lajos_, Dec 01 2006

%t Table[Mod[-n, 3], {n, 0, 100}] (* _Wesley Ivan Hurt_, Jun 16 2014 *)

%o (Haskell)

%o a080425 = (`mod` 3) . (3 -) . (`mod` 3)

%o a080425_list = cycle [0, 2, 1] -- _Reinhard Zumkeller_, Feb 22 2013

%o (Magma) [-n mod 3 : n in [0..100]]; // _Wesley Ivan Hurt_, Jun 16 2014

%o (PARI) a(n)=2*n%3 \\ _Charles R Greathouse IV_, Sep 24 2015

%Y Cf. A001045, A001477, A007318, A010872, A130196, A131534.

%K nonn,easy

%O 0,2

%A _Paul Barry_, Feb 20 2003

%E More terms from _Reinhard Zumkeller_, Jul 30 2005

%E New name from _Joerg Arndt_, Apr 21 2014