login
A225302
Smallest prime p such that n*(p-1)-1 and n*(p+1)+1 are both prime, or 0 if no such p exists.
1
5, 5, 3, 2, 5, 2, 3, 11, 3, 3, 5, 2, 0, 2, 3, 0, 5, 5, 0, 2, 5, 3, 11, 2, 0, 5, 3, 0, 7, 7, 0, 2, 5, 3, 5, 11, 3, 5, 7, 0, 61, 2, 0, 7, 3, 0, 13, 11, 3, 11, 11, 0, 19, 2, 0, 5, 3, 0, 19, 2, 0, 17, 5, 3, 7, 5, 0, 5, 3, 3, 11, 7, 0, 2, 7, 0, 5, 109
OFFSET
1,1
COMMENTS
Numbers n such that a(n) = 0: 13, 16, 19, 25, 28, 31, 40, 43, 46, 52, 55, 58, 61, 67, 73, 76, ...
a(n) = 0 if n == 1 (mod 3) and none of the pairs {n-1, 3n+1}, {2n-1, 4n+1}, {n+1, n+2} have both members prime. On Dickson's conjecture "if" can be replaced with "if and only if". - Charles R Greathouse IV, May 07 2013
Smallest k > 1 such that n^k - n - 1 and n^k + n + 1 are both prime, or 0 if no such k exists: 0, 3, 2, 0, 2, 2, 0, 3, 3, 0, 4, 2, 0, 2, 3, 0, 2, 3, 0, 2, 2, 0, ... - Juri-Stepan Gerasimov, May 09 2013
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 5 because 1*5 - 1 - 1 = 3 and 1*5 + 1 + 1 = 7 are both prime,
a(2) = 5 because 2*5 - 2 - 1 = 7 and 2*5 + 2 + 1 = 13 are both prime,
a(3) = 3 because 3*3 - 3 - 1 = 5 and 3*3 + 3 + 1 = 13 are both prime.
MATHEMATICA
a[n_] := Block[{p = 2}, If[n < 5, {5, 5, 3, 2}[[n]], If[Mod[n, 3] == 1, If[PrimeQ[2*n-1] && PrimeQ[4*n+1], 3, 0], While[! PrimeQ[n*(p - 1) -1] || ! PrimeQ[n*(p + 1) +1], p = NextPrime@p]; p]]]; Array[a, 80] (* Giovanni Resta, May 05 2013 *)
PROG
(PARI) a(n)=forprime(p=2, 5, if(isprime(n*p-n-1) && isprime(n*p+n+1), return(p))); if(n%3==1, return(0)); forprime(p=7, , if(isprime(n*p-n-1) && isprime(n*p+n+1), return(p))) \\ Charles R Greathouse IV, May 07 2013
CROSSREFS
Cf. A225063.
Sequence in context: A158349 A320478 A364881 * A079384 A308651 A260719
KEYWORD
nonn
AUTHOR
EXTENSIONS
Corrected by R. J. Mathar, May 05 2013
STATUS
approved