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

%I #37 Dec 27 2023 08:37:54

%S 1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,

%T 23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,

%U 7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1,7,9,23,1

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

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

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

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

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

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

%F E.g.f.: 5*cosh(x) + 15*sinh(x) - 4*cos(x) - 8*sin(x). - _G. C. Greubel_, Mar 22 2016

%t PowerMod[7,Range[0,100],40] (* or *) PadRight[{},100,{1,7,9,23}] (* _Harvey P. Dale_, Nov 14 2013 *)

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

%o (PARI) a(n)=lift(Mod(7,40)^n) \\ _Charles R Greathouse IV_, Mar 22 2016

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

%K nonn,easy

%O 0,2

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