login
Smallest m in range 1..phi(n) such that 9^m == 1 mod n, or 0 if no such number exists.
10

%I #13 Jan 22 2023 17:36:11

%S 0,1,0,1,2,0,3,1,0,2,5,0,3,3,0,2,8,0,9,2,0,5,11,0,10,3,0,3,14,0,15,4,

%T 0,8,6,0,9,9,0,2,4,0,21,5,0,11,23,0,21,10,0,3,26,0,10,3,0,14,29,0,5,

%U 15,0,8,6,0,11,8,0,6,35,0,6,9,0,9,15,0,39,2,0,4,41,0

%N Smallest m in range 1..phi(n) such that 9^m == 1 mod n, or 0 if no such number exists.

%t Table[SelectFirst[Range[EulerPhi[n]],PowerMod[9,#,n]==1&],{n,90}]/. Missing[ "NotFound"] -> 0 (* _Harvey P. Dale_, Jan 22 2023 *)

%o (PARI) a(n) = {for (i = 1, eulerphi(n), if ((9^i % n) == 1, return(i));); return (0);} \\_Michel Marcus_, Jul 31 2013

%o (Magma) [0] cat [Modorder(9, n): n in [2..100]]; // _Vincenzo Librandi_, Apr 01 2014

%Y Cf. A070667-A070675, A002326, A070676, A053447, A070677, A070681, A070678, A053451, A070682, A070680, A070683.

%K nonn

%O 1,5

%A _N. J. A. Sloane_ and _Amarnath Murthy_, May 08 2002