OFFSET
1,1
COMMENTS
Conjecture 1: If p and p+2 are prime (twin primes), then p+2 divides p^(p+2)+2. Compared to the 1517 twin primes less than 130000, there were 33 pseudoprime occurrences. Conjecture 2: If for a randomly chosen prime p, p+2 divides p^(p+2)+2, then there is a greater than 98% chance that p and p+2 are twin primes. The sequence also contains several Carmichael numbers. In addition, If we relax the condition that p is prime or just odd, we get A001567: 341, 561, 645, 1105, 1387, 1729, 1905, 2047, ... (Sarrus numbers).
Proof 1: p^(p+2) == p == -2 (mod p+2). - Thomas Ordowski, Dec 19 2013
Base-2 pseudoprimes k such that k-2 is prime. - Charlie Neder, Mar 04 2019
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
For primes p if p+2 divides p^(p+2) + 2 then p+2 is likely to be prime. If p+2 is composite, then p+2 is a pseudotwinprime.
EXAMPLE
For prime p = 643, 645 divides 643^(645) + 2 and 645 is composite.
MATHEMATICA
Select[Range[10^5], CompositeQ[#] && PowerMod[2, # - 1, #] == 1 && PrimeQ[# - 2] &] (* Amiram Eldar, Jun 28 2019 *)
PROG
(PARI) pitwins(n) = { local(c, x); c=0; forprime(x=3, n, if(isprime(x+2), c++) ); return(c) } \\ The number of twin prime pairs <= n.
twtotwp2(n1, n2, k=2) = { local(x, y, x2, c); c=0; forprime(x=n1, n2, x2=x+2; y=x^x2+k; if(y%x2==0 && !isprime(x2), c++; print1(x+2", "); ); ); /* print(); print(c", "pitwin(n2)); */}
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Jan 09 2005
STATUS
approved