OFFSET
1,1
LINKS
Dimitri Papadopoulos, Table of n, a(n) for n = 1..167
FORMULA
log(a(n)) = prime(n) (approximately, empirical observation). - Dimitri Papadopoulos, Dec 27 2018
EXAMPLE
For n = 1 there are no such j, so the condition is vacuously satisfied and we can take k=1, getting a(1)=2. - N. J. A. Sloane, Feb 10 2015
MATHEMATICA
a[1] = 2; a[2] = 3; a[n_] := Module[{p, m, r, r0, r1}, p = Prime[n]; m = LCM @@ Range[2, p - 1]; r = Reduce[k > 0 && p*k + m*j == 1, {k, j}, Integers]; r0 = r /. C[_] -> 0; r1 = r /. C[_] -> 1; If[r0 === False, r1[[1, 2]], Min[r0[[1, 2]], r1[[1, 2]]]]*p]; Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Feb 09 2015 *)
PROG
(Magma) /* By definition (slow): */
S:=[]; for n in [1..9] do k:=1; while not forall{j: j in [2..NthPrime(n)-1] | IsOne(k*NthPrime(n) mod j)} do k:=k+1; end while; Append(~S, k*NthPrime(n)); end for; S; /* or */
[p eq 2 select p else Modinv(p, Lcm([1..p-1]))*p: p in PrimesUpTo(60)]; // Bruno Berselli, Feb 08 2015
(PARI) a(n) = {p=prime(n); k=1; for(n=2, p-1, k=lcm(k, n)); for(j=1, p, if((j*k+1)/p==ceil((j*k+1)/p), t=j*k+1; break())); return(t); } \\ Dimitri Papadopoulos, Dec 28 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Mark Troll (mtroll(AT)u.washington.edu), Oct 22 2004
EXTENSIONS
Edited and extended by Ray Chandler, Oct 29 2004
Added "positive" to definition. - N. J. A. Sloane, Feb 10 2015
STATUS
approved