OFFSET
1,1
COMMENTS
Corresponding values of k: 7, 9, 12, 24, 30, 36, 63, 90, 102, 117, 126, 135, 150. All except the first one, 7, are multiples of 3.
LINKS
Zak Seidov, Table of n, a(n) for n = 1..1000
EXAMPLE
17 is the seventh prime, and 17 - 2 * 7 = 3 and 17 + 2 * 7 = 31, both of which are prime, so 17 is in the sequence.
23 is the ninth prime, and 23 - 2 * 9 = 5 and 23 + 2 * 9 = 41, both of which are prime, so 23 is in the sequence.
29 is the tenth prime, and 29 - 2 * 10 = 9 and 29 + 2 * 10 = 49, neither of which is prime, so 29 is not in the sequence.
MATHEMATICA
Reap[Sow[17]; Do[p = Prime[k]; If[PrimeQ[p + 2 * k] && PrimeQ[p - 2 * k], Sow[p]], {k, 9, 10^3, 3}]][[2, 1]]
Select[Table[{n, Prime[n]}, {n, 1000}], AllTrue[#[[2]]+{2#[[1]], -2#[[1]]}, PrimeQ]&][[All, 2]] (* Harvey P. Dale, Aug 05 2022 *)
PROG
(PARI){print(17", "); forstep(k=9, 885, 3, p=prime(k); if(isprime(p+2*k)&& isprime(p-2*k), print(p", ")))}
(PARI) k=0; forprime(p=2, 1e6, k++; if(isprime(p-2*k) && isprime(2+2*k), print1(p", "))) \\ Charles R Greathouse IV, Jan 07 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Jan 07 2014
STATUS
approved