%I #20 Jun 29 2024 07:16:41
%S 5,5,3,5,3,5,11,5,3,11,7,11,29,7,5,5,5,3,5,3,7,11,137,23,7,5,3,59,11,
%T 3,5,17,47,11,11,7,7,7,5,23,11,11,3,3,29,31,11,13,29,29,17,5,19,11,29,
%U 3,11,5,5,47,5,5,11,17,3,17,3,5,11,11,5,11,41,3,19
%N The second-smallest prime of the form (p-prime(n))/(prime(n)-1), where p is also prime.
%H Amiram Eldar, <a href="/A089486/b089486.txt">Table of n, a(n) for n = 1..1000</a>
%e For n = 1, prime(n) = 2, and the ratios generated are (3-2)/1 = 1 (not prime), (5-2)/1 = 3 (prime, first), (7-2)/1 = 5 (prime, second), and so a(1) = 5.
%t a[n_, r_] := Module[{p = Prime[n], q, rat, c = 0}, q = p; While[c < r, q = NextPrime[q]; If[PrimeQ[rat = (q - p)/(p - 1)], c++]]; rat]; Table[a[n, 2], {n, 1, 100}] (* _Amiram Eldar_, Jun 29 2024 *)
%o (PARI) /* r is the occurrence desired 1=first,2=second etc. */ diff2sqp2(n,r) = { forprime(q=2,n, c=0; forprime(p=q+1,n, y=(p-q)/(q-1); if(y==floor(y), if(isprime(y),c++; if(c==r, print1(y",");break)) ) ) ) }
%Y Cf. A089452, A089487.
%K easy,nonn
%O 1,1
%A _Cino Hilliard_, Dec 28 2003
%E Edited and corrected by _D. S. McNeil_, Dec 06 2010
%E More terms from _Amiram Eldar_, Jun 29 2024
|