login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = n^n! mod 7.
1

%I #31 Sep 08 2022 08:45:55

%S 0,1,4,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,

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

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

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

%C For n > 2, periodic with period 7: repeat [1, 1, 1, 1, 0, 1, 1].

%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 G.f.: x*(3*x^8 - x^5 - x^4 - x^3 - x^2 - 4*x - 1)/(x^7 - 1). - _Chai Wah Wu_, Jun 04 2016

%F a(n) = sign(n mod 7) for n > 2. - _Wesley Ivan Hurt_, Dec 23 2016

%p A185058:= n -> [0, 1, 1, 1, 1, 1, 1][(n mod 7)+1]: 0,1,4,seq(A185058(n), n=3..100); # _Wesley Ivan Hurt_, Dec 23 2016

%t Table[PowerMod[n,n!,7],{n,0,84}]

%t Join[{0, 1, 4},LinearRecurrence[{0, 0, 0, 0, 0, 0, 1},{1, 1, 1, 1, 0, 1, 1},82]] (* _Ray Chandler_, Aug 26 2015 *)

%t PadRight[{0,1,4},120,{0,1,1,1,1,1,1}] (* _Harvey P. Dale_, May 29 2020 *)

%o (Magma) [0,1,4] cat &cat [[1, 1, 1, 1, 0, 1, 1]^^20]; // _Wesley Ivan Hurt_, Dec 23 2016

%K nonn,easy

%O 0,3

%A _José María Grau Ribas_, Jan 21 2012