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”).

Maximal t in [2, prime(n)-1] such that all the smallest positive residues of 2!,3!,...,t! modulo prime(n) are distinct.
2

%I #47 Dec 18 2014 02:13:34

%S 4,5,3,8,5,4,7,5,9,12,6,10,9,11,4,15,7,8,7,13,18,9,18,13,17,9,10,10,

%T 23,11,11,18,17,17,18,21,15,14,28,13,26,36,8,13,32,22,16,6,24,15,22,

%U 28,21,15,28,16,42,23,32,25,8,20,18,20,33,26,10,35,14,5,29

%N Maximal t in [2, prime(n)-1] such that all the smallest positive residues of 2!,3!,...,t! modulo prime(n) are distinct.

%C a(n) = prime(n)-1, if A247190(n)=0; else a(n) = m-1, where m is defined in A247190.

%C See comments in A247190.

%H Peter J. C. Moses and Chai Wah Wu, <a href="/A245085/b245085.txt">Table of n, a(n) for n = 3..10002</a> First 1000 terms from Peter J. C. Moses.

%F a(n) >= A247190(n).

%t Table[ans={};

%t NestWhile[#+1&,2,(AppendTo[ans,Mod[#!,Prime[n]]];(Length[ans]<Prime[n]-1)&&(Max[Last[Transpose[Tally[ans]]]]==1))&]-1,{n,3,50}] (* _Peter J. C. Moses_, Nov 25 2014 *)

%o (Python)

%o from sympy import prime

%o def A245085(n):

%o ....p, f, fv = prime(n), 1, {}

%o ....for i in range(2,p):

%o ........f = (f*i) % p

%o ........if f in fv:

%o ............return i-1

%o ........else:

%o ............fv[f] = i

%o ....return p-1 # _Chai Wah Wu_, Dec 15 2014

%Y Cf. A000040, A247190.

%K nonn

%O 3,1

%A _Vladimir Shevelev_, Nov 25 2014

%E More terms from _Peter J. C. Moses_, Nov 25 2014