OFFSET
1,1
COMMENTS
Computing and storing the indices of lower or upper twin primes is useful in computing twinl(n) or the n-th lower twin prime from a large file of primes.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
Every prime has an index denoting the position the prime is in the sequence 1,2,3,... For example, 5 is the 3rd prime number so 5 has index 3, 3 has index 2 etc. It is when an upper twin prime's lower member has an index that is also prime that we list the upper prime.
EXAMPLE
13 is the upper twin prime of the pair 11,13. The lower member 11 is the 5th prime number and the index 5 is prime so 13 is in the table.
MATHEMATICA
Select[Table[Prime[p], {p, Prime[Range[300]]}]+2, PrimeQ] (* Harvey P. Dale, Mar 07 2025 *)
PROG
(PARI) g(n) = for(x=1, n, p1=prime(x); p2=prime(x+1); if(p1+2==p2&&isprime(x), print1 (p2", ")))
CROSSREFS
KEYWORD
easy,nonn,changed
AUTHOR
Cino Hilliard, May 17 2007
STATUS
approved