OFFSET
1,1
COMMENTS
a(n) >= prime(n+prime(n)-1), with equality for n = 1, 2 and 4. Any others?
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 19 because prime(3) = 5 and the primes 5, 7, 11, 13, 17, 19 contain a complete set of residues mod 5: 5 == 0, 11 == 1, 7 and 17 == 2, 13 == 3, 19 == 4 (mod 5).
MAPLE
f:= proc(n) local p, S, q;
p:= ithprime(n);
S:= {$1..p-1};
q:= p;
do
q:= nextprime(q);
S:= S minus {q mod p};
if S = {} then return q fi;
od;
end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_] := Module[{p = Prime[n], s = {}, q}, q = p; While[Length[s = Union[AppendTo[s, Mod[q, p]]]] < p, q = NextPrime[q]]; q]; Array[a, 50] (* Amiram Eldar, Jan 31 2023 *)
PROG
(Python)
from sympy import prime, nextprime
def a(n):
pn = p = prime(n); res = set()
while True:
res.add(p%pn)
if len(res) == pn: return p
p = nextprime(p)
print([a(n) for n in range(1, 54)]) # Michael S. Branicky, Jan 31 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Jan 31 2023
STATUS
approved