This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A287615 #31 Oct 06 2020 06:54:52 %S A287615 5,13,19,29,37,47,79,101,97,103,113,131,127,137,181,199,181,227,233, %T A287615 229,239,257,277,283,311,307,317,409,383,367,389,409,439,521,463,509, %U A287615 491,509,613,571,541,563,577,587,619,653,677,677,709,743,787,853,743,877 %N 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. %C A287615 Prime p such that p = k * q + r, r < q < p primes; k even multiples such that p is minimal. %H A287615 Charles R Greathouse IV, <a href="/A287615/b287615.txt">Table of n, a(n) for n = 1..10000</a> %H A287615 Ophir Spector, <a href="https://sites.google.com/site/ophirscobwebs/maths-fun">C++ code and Excel file</a> %e A287615 a(1) = 5, as r = 2, q = 3, p = 5, is the smallest prime such that 5 = 2 mod 3. %e A287615 a(9) = 97, as r = 23, q = 37, p = 97. 97 = 2 * 37 + 23 is smaller than 139 = 4 * 29 + 23 (A129919). %p A287615 f:= proc(n) local p,q,r; %p A287615 r:= ithprime(n); %p A287615 p:= r+1; %p A287615 do %p A287615 p:= nextprime(p); %p A287615 q:= max(numtheory:-factorset(p-r)); %p A287615 if q > r then return p fi %p A287615 od: %p A287615 end proc: %p A287615 map(f, [$1..100]); # _Robert Israel_, Jun 05 2017 %t A287615 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]]] ]; %t A287615 Array[a, 100] (* _Jean-François Alcover_, Oct 06 2020, after _Robert Israel_ *) %o A287615 (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 %o A287615 (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 %Y A287615 Cf. A129919. %K A287615 nonn,easy %O A287615 1,1 %A A287615 _Ophir Spector_, May 27 2017