login
a(n) = n^3 mod 7.
3

%I #36 Dec 14 2023 05:12:25

%S 0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,

%T 6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,

%U 6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1,6,1,6,6,0,1,1

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

%C Periodic with period 7.

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

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

%F G.f.: x*(1 + x + 6*x^2 + x^3 + 6*x^4 + 6*x^5)/(1-x^7). - _Vincenzo Librandi_, Mar 27 2016

%t PowerMod[Range[0,120],3,7] (* or *) LinearRecurrence[{0,0,0,0,0,0,1},{0,1,1,6,1,6,6},120] (* or *) PadRight[{},120,{0,1,1,6,1,6,6}] (* _Harvey P. Dale_, Nov 29 2013 *)

%o (Sage) [power_mod(n,3,7 ) for n in range(0, 101)] # _Zerinvary Lajos_, Oct 29 2009

%o (Magma) [Modexp(n, 3, 7 ): n in [0..100]]; // _Vincenzo Librandi_, Mar 27 2016

%o (PARI) a(n)=n^3%7 \\ _Charles R Greathouse IV_, Apr 06 2016

%K nonn,easy

%O 0,4

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