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

%I #33 Dec 14 2023 05:06:38

%S 1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,

%T 36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,

%U 7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36,37,1,7,6,42,36

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

%C Sequence is periodic with length 6. Since a(21) = 42 (or -1), 43 is prime in Z[sqrt(7)]. - _Alonso del Arte_, Oct 12 2012

%H G. C. Greubel, <a href="/A070425/b070425.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 (1,0,-1,1).

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

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

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

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

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

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

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

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

%K nonn,easy

%O 0,2

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