login
a(n) = 7^n mod 30.
1

%I #41 Dec 27 2023 08:38:01

%S 1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,

%T 13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,

%U 19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13,1,7,19,13

%N a(n) = 7^n mod 30.

%H G. C. Greubel, <a href="/A070414/b070414.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1). - _R. J. Mathar_, Apr 20 2010

%F From _R. J. Mathar_, Apr 20 2010: (Start)

%F a(n) = a(n-1) - a(n-2) + a(n-3).

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

%F From _G. C. Greubel_, Mar 20 2016: (Start)

%F a(n) = a(n-4).

%F E.g.f.: 10*exp(x) - 9*cos(x) - 3*sin(x). (End)

%t PowerMod[7, Range[0, 50], 30] (* _G. C. Greubel_, Mar 20 2016 *)

%t LinearRecurrence[{1,-1,1},{1,7,19},90] (* or *) PadRight[{},90,{1,7,19,13}] (* _Harvey P. Dale_, Aug 09 2020 *)

%o (Sage) [power_mod(7,n,30) for n in range(0,84)] # _Zerinvary Lajos_, Nov 27 2009

%o (PARI) a(n) = lift(Mod(7, 30)^n); \\ _Altug Alkan_, Mar 20 2016

%o (Magma) [Modexp(7, n, 30): n in [0..100]]; // _Bruno Berselli_, Mar 22 2016

%K nonn,easy

%O 0,2

%A _N. J. A. Sloane_, May 12 2002