login
Period 2: repeat (0,3).
13

%I #48 Jan 16 2024 01:49:00

%S 0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,

%T 0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,

%U 0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0

%N Period 2: repeat (0,3).

%C Also decimal expansion of 1/33 = .030303030...

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

%F a(n) = (3/2)*(1 - (-1)^n) = 3*(n mod 2). - _Paolo P. Lava_, Oct 20 2006

%F a(n) = A010698(n)/2 - 1. - _Martin Ettl_, Nov 11 2012

%F a(n) = 2^(1 - (-1)^n) - 1. - _Bruno Berselli_, Dec 29 2015

%F From _Chai Wah Wu_, Jun 04 2016: (Start)

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

%F G.f.: 3*x/(1 - x^2). (End)

%F E.g.f.: 3*sinh(x). - _Ilya Gutkovskiy_, Jun 04 2016

%t 3Mod[Range[0, 99], 2] (* _Alonso del Arte_, Mar 25 2020 *)

%o (PARI) a(n)=n%2*3 \\ _Charles R Greathouse IV_, Nov 20 2011

%o (Maxima) makelist(if evenp(n) then 0 else 3, n, 0, 30); /* _Martin Ettl_, Nov 09 2012 */

%o (Magma) &cat [[0,3]^^50]; // _Bruno Berselli_, Dec 29 2015

%o (Scala) (0 to 99).map(_ % 2 * 3) // _Alonso del Arte_, Mar 25 2020

%Y Cf. A010680 (1/11), A010695 (2^(1 - (-1)^n) + 1).

%K nonn,cons,easy

%O 0,2

%A _N. J. A. Sloane_

%E More terms from _Paolo P. Lava_, Oct 20 2006