login
a(n) = 7^n mod 41.
2

%I #25 Dec 18 2023 14:07:06

%S 1,7,8,15,23,38,20,17,37,13,9,22,31,12,2,14,16,30,5,35,40,34,33,26,18,

%T 3,21,24,4,28,32,19,10,29,39,27,25,11,36,6,1,7,8,15,23,38,20,17,37,13,

%U 9,22,31,12,2,14,16,30,5,35,40,34,33,26,18,3,21,24,4,28,32,19,10,29,39

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

%C Sequence is periodic with length 40. Since a(20) = 40 (or -1), 41 is prime in Z[sqrt(7)]. - _Alonso del Arte_, Oct 11 2012

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

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

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

%F a(n) = a(n - 1) - a(n - 20) + a(n - 21).

%F G.f.: ( -1 -6*x -x^2 -7*x^3 -8*x^4 -15*x^5 +18*x^6 +3*x^7 -20*x^8 + 24*x^9 +4*x^10 -13*x^11 -9*x^12 +19*x^13 +10*x^14 -12*x^15 -2*x^16 - 14*x^17 +25*x^18 -30*x^19 -6*x^20 ) / ( (x - 1)*(x^4 + 1)*(x^16 -x^12 + x^8 -x^4 +1) ). (End)

%F a(n) = a(n-40). - _G. C. Greubel_, Mar 22 2016

%t PowerMod[7, Range[0, 74], 41] (* _Alonso del Arte_, Oct 12 2012 *)

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

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

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

%K nonn,easy

%O 0,2

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