%I #45 Dec 14 2023 05:06:34
%S 1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,
%T 11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,
%U 7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11,1,7,11
%N a(n) = 7^n mod 38.
%C Period 3: repeat [1, 7, 11].
%C Equivalently 7^n mod 19. - _Zerinvary Lajos_, Nov 27 2009
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).
%F From _R. J. Mathar_, Apr 20 2010: (Start)
%F a(n) = a(n-3) for n>2.
%F G.f.: ( 1+7*x+11*x^2 ) / ( (1-x)*(1+x+x^2) ). (End)
%F a(n) = (19 - 16*cos(2*n*Pi/3) - 4*sqrt(3)*sin(2*n*Pi/3))/3. - _Wesley Ivan Hurt_, Jun 29 2016
%p seq(op([1, 7, 11]), n=0..50); # _Wesley Ivan Hurt_, Jun 29 2016
%t PowerMod[7, Range[0, 50], 38] (* _G. C. Greubel_, Mar 21 2016 *)
%o (Sage) [power_mod(7,n,19) for n in range(0,90)] # or:
%o [power_mod(7,n,38) for n in range(0,90)] # _Zerinvary Lajos_, Nov 27 2009
%o (PARI) a(n)=lift(Mod(7,19)^n) \\ _Charles R Greathouse IV_, Mar 22 2016
%o (Magma) [Modexp(7, n, 19): n in [0..100]]; // _Bruno Berselli_, Mar 22 2016
%K nonn,easy
%O 0,2
%A _N. J. A. Sloane_, May 12 2002
|