A266239 a(n) is the smallest k such that the following are four primes: prime(n)*k-1, prime(n)*k+1, prime(n)*k^2-1, prime(n)*k^2+1. Or -1 if no such k exists.
3, 2, 6, 66, 300, 24, 3744, 27000, 6, 1080, 960, 90, 30, 366, 9204, 8154, 1170, 840, 330, 6090, 84, 27720, 324, 90, 186, 4740, 2856, 6, 24270, 936, 5220, 1560, 6, 1500, 510, 120, 930, 3270, 30, 8520, 29700, 1200, 23310, 1056, 3540, 90, 3420, 2370, 9654, 83040, 2610, 9270, 2610
Offset: 1
Keywords
Examples
a(1)=3 because the following are four primes: 2*3-1, 2*3+1, 2*9-1, 2*9+1.
Programs
-
PARI
a(n) = {k = 1; p = prime(n); while (! (isprime(p*k-1) && isprime(p*k+1) && isprime(p*k^2-1) && isprime(p*k^2+1)), k++);k;} \\ Michel Marcus, Dec 27 2015
-
Python
from sympy import isprime TOP=10**9 for p in range(2, 333): if isprime(p): failed = True for x in range(1, TOP): if isprime(p*x+1) and isprime(p*x-1) and isprime(p*x*x-1) and isprime(p*x*x+1): print(x, end=', ') failed = False break if failed: print(-1, end=', ')
Comments