A287615 Let r = prime(n). Then a(n) is the smallest prime p such that there is a prime q with p > q > r and p mod q = r.
5, 13, 19, 29, 37, 47, 79, 101, 97, 103, 113, 131, 127, 137, 181, 199, 181, 227, 233, 229, 239, 257, 277, 283, 311, 307, 317, 409, 383, 367, 389, 409, 439, 521, 463, 509, 491, 509, 613, 571, 541, 563, 577, 587, 619, 653, 677, 677, 709, 743, 787, 853, 743, 877
Offset: 1
Examples
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).
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- Ophir Spector, C++ code and Excel file
Crossrefs
Cf. A129919.
Programs
-
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 *)
-
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
Comments