login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Smallest m in range 2..n-1 such that m^5 == 1 mod n, or 1 if no such number exists.
1

%I #12 Jul 20 2015 07:29:34

%S 1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,3,1,1,6,1,1,1,1,1,2,1,4,1,

%T 1,1,1,1,1,1,10,1,1,5,1,1,1,1,1,11,1,1,1,1,16,1,1,1,1,1,9,33,1,1,1,25,

%U 1,1,1,1,5,1,1,1,16,1,15,1,1,1,1,37,1,1,1,1,1,9,1,1

%N Smallest m in range 2..n-1 such that m^5 == 1 mod n, or 1 if no such number exists.

%H Alois P. Heinz, <a href="/A070670/b070670.txt">Table of n, a(n) for n = 1..10000</a>

%p a:= proc(n) local m;

%p for m from 2 to n-1 do

%p if m &^ 5 mod n = 1 then return m fi

%p od; 1

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Jun 29 2014

%t a[n_] := (For[m = 2, m <= n - 1, m++, If[PowerMod[m, 5, n] == 1, Return[m]]]; 1); Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jul 20 2015 *)

%o (PARI) a(n) = {for (m=2, n-1, if (lift(Mod(m, n)^5) == 1, return (m));); return (1);} \\ _Michel Marcus_, Jun 29 2014

%Y Cf. A070667.

%K nonn

%O 1,11

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