OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..531 (terms 1..100 from Robert Israel)
EXAMPLE
a(3) = 19 because prime(3) = 5 and the primes (5, 7, 11, 13, 17, 19} from 17 to 19 contain a complete set of residue mod 5: 5 == 0, 11 == 1, 7 == 2, 13 == 3 and 19 == 4 (mod 5).
MAPLE
P:= select(isprime, [2, seq(i, i=3..10^6, 2)]): nP:= nops(P):
f:= proc(i) local j, k, Q;
Q:=Array(1..1, j -> {$1..P[i+j-1]-1});
for j from i+1 do
for k from 1 to j-i do
Q(k):= Q(k) minus {P[j] mod P[i+k-1]};
if Q(k) = {} then return P[j] fi;
od;
Q(j-i+1):= {$1..P[j]-1} minus convert(P[i..j] mod P[j], set);
if Q(j-i+1) = {} then return P[j] fi;
od
end proc:
map(f, [$1..60]);
PROG
(Python)
from sympy import sieve
def a(n):
pn = p = sieve[n]; res = dict(); i = 0
while True:
if p not in res:
res[p] = {0} | {q%p for q in res}
for q in res:
res[q].add(p%q)
if len(res[q]) == q:
return p
i += 1
p = sieve[n+i]
print([a(n) for n in range(1, 54)]) # Michael S. Branicky, Feb 02 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Jan 30 2023
STATUS
approved