OFFSET
1,1
COMMENTS
Prime p such that p = k * q + r, r < q < p primes; k even multiples such that p is minimal.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Ophir Spector, C++ code and Excel file
EXAMPLE
a(1) = 5, as r = 2, q = 3, p = 5, is the smallest prime such that 5 = 2 mod 3.
a(9) = 97, as r = 23, q = 37, p = 97. 97 = 2 * 37 + 23 is smaller than 139 = 4 * 29 + 23 (A129919).
MAPLE
f:= proc(n) local p, q, r;
r:= ithprime(n);
p:= r+1;
do
p:= nextprime(p);
q:= max(numtheory:-factorset(p-r));
if q > r then return p fi
od:
end proc:
map(f, [$1..100]); # Robert Israel, Jun 05 2017
MATHEMATICA
a[n_] := Module[{p, q, r}, r = Prime[n]; p = r+1; While[True, p = NextPrime[p]; q = Max[FactorInteger[p-r][[All, 1]]]; If[q>r, Return[p]]] ];
Array[a, 100] (* Jean-François Alcover, Oct 06 2020, after Robert Israel *)
PROG
(PARI) findfirstTerms(n)=my(t:small=0, a:vec=[]); forprime(r=2, , forprime(p=r+2, , forprime(q=r+2, p-2, if(p%q==r, a=concat(a, [p]); if(t++==n, a[1]-=2; return(a), break(2)))))) \\ R. J. Cano, Jun 06 2017
(PARI) first(n)=my(v=vector(n), best, k=1); v[1]=5; forprime(r=3, prime(n), best=oo; forprime(q=r+2, , if(q>=best, v[k++]=best; next(2)); forstep(p=r+2*q, best, 2*q, if(isprime(p), best=p; break)))); v \\ Charles R Greathouse IV, Jun 07 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ophir Spector, May 27 2017
STATUS
approved