login
Least k such that factorials have exactly n distinct residues mod k.
2

%I #11 Aug 03 2016 09:36:58

%S 1,2,3,5,7,11,22,25,55,13,26,17,34,57,76,95,23,46,29,58,31,62,93,155,

%T 319,37,74,129,41,82,47,94,141,235,53,106,59,118,71,142,61,67,134,73,

%U 146,219,365,511,79,158,237,395,553,1241,83,166,332,747,89,178,291,485

%N Least k such that factorials have exactly n distinct residues mod k.

%H David W. Wilson, <a href="/A038204/b038204.txt">Table of n, a(n) for n = 1..10000</a>

%t s = Table[Length@ Union@ Mod[Range[10^3]!, n], {n, 2000}]; Table[FirstPosition[s, n], {n, 62}] // Flatten (* _Michael De Vlieger_, Aug 03 2016, Version 10 *)

%o (PARI) a(n)=my(k=n,t=1); while(#Set(vector(k,i,t=(t*i)%k))!=n, k++; t=1); k \\ _Charles R Greathouse IV_, Aug 03 2016

%Y Cf. A038203.

%K nonn

%O 1,2

%A _David W. Wilson_