OFFSET
1,1
COMMENTS
If n>3 is odd and not a multiple of 3, then a(n) is a multiple of 6; e.g., a(5) = 6, a(7) = 150, a(11) = 78. If n>3 is even and not a multiple of 3, then a(n) is a multiple of 3. In short, for n>1, k*n should be a multiple of 6. - Zak Seidov, Mar 13 2014
EXAMPLE
1*2 +/- 1 (1 and 3) and 1*2^2 +/- 1 (3 and 5) are not two sets of twin primes. 2*2 +/- 1 (3 and 5) and 2*2^2 +/- 1 (7 and 9) are not two sets of twin primes. However, 3*2 +/- 1 (5 and 7) and 3*2^2 +/- 1 (11 and 13) are two sets of twin primes. Thus, a(2) = 3.
PROG
(Python)
from sympy import isprime
def b(n):
for k in range(10**5):
if isprime(k*n+1) and isprime(k*n-1) and isprime(k*(n**2)+1) and isprime(k*(n**2)-1):
return k
n = 1
while n < 100:
print(b(n))
n += 1
(PARI) a(n) = {k = 1; while (! (isprime(k*n+1) && isprime(k*n-1) && isprime(k*n^2+1) && isprime(k*n^2-1)), k++); k; } \\ Michel Marcus, Mar 15 2014
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Derek Orr, Mar 09 2014
STATUS
approved