OFFSET
1,1
COMMENTS
Here prime(n) is the n-th prime number, pip(n) = prime(prime(n)) is the n-th prime-indexed prime.
The ratio of successive terms appears to converge. They are as follows for n = 2 to 6:
n pip(10^n) / pip(10^(n-1))
-- -----------------------------
2 4.625000000000000000000000000
3 6.756756756756756756756756757
4 8.132000000000000000000000000
5 8.420560747663551401869158878
6 8.458145919738302470938723056
EXAMPLE
The first 10^1 prime-indexed primes are 3, 5, 11, 17, 31, 41, 59, 67, 83, 109. The 8 primes 3, 5, 11, 17, 31, 41, 59, 109 are also twin prime members. So 8 is the first term of this sequence.
PROG
(PARI) g(n) = c=0; for(x=1, n, y=prime(prime(x)); if(isprime(y+2)||isprime(y-2), c++)); c
(PARI) lista(pmax) = {my(ctwin = 0, cpip = 0, pow = 10, prev = 3, k = 2, isprev = 1, is); forprime(p = 5, , k++; is = isprime(k); if(isprev, cpip++); if(p == prev + 2 && (isprev || is), ctwin++); if(cpip == pow, print1(ctwin, ", "); pow* = 10); prev = p; isprev = is); } \\ Amiram Eldar, Jul 02 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Cino Hilliard, May 09 2007
EXTENSIONS
a(7)-a(9) from Amiram Eldar, Jul 02 2024
STATUS
approved