login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A329457
Least positive integer x such that both n*x + n + x and n*x - n - x are primes, or -1 if no such x exists.
0
5, 4, 3, 2, 5, 2, 7, 2, 3, 3, 13, 2, 9, 2, 3, 3, 5, 2, 3, 4, 5, 6, 7, 3, 9, 5, 5, 4, 13, 3, 3, 2, 9, 4, 11, 3, 21, 4, 9, 3, 5, 2, 7, 2, 5, 4, 17, 2, 19, 5, 3, 7, 7, 2, 3, 5, 5, 7, 7, 8, 19, 2, 5, 3, 23, 3, 15, 5, 3, 6, 19, 11, 67, 2, 3, 3, 7, 5, 9, 4, 9, 6, 5, 2, 13, 4
OFFSET
2,1
EXAMPLE
5 is the least positive integer x such that both 2*x + 2 + x = 17 and 2*x - 2 - x = 3 are primes. Therefore a(2) = 5.
MATHEMATICA
Array[Block[{x = 1}, While[! AllTrue[# x + {-1, 1} (# + x), PrimeQ], x++]; x] &, 86, 2] (* Michael De Vlieger, Dec 27 2019 *)
PROG
(PARI) a(n) = my(x=1); while (!isprime(n*x + n + x) || !isprime(n*x - n - x), x++); x; \\ Michel Marcus, Nov 14 2019
CROSSREFS
Sequence in context: A190137 A003561 A201327 * A081760 A261218 A094097
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Nov 13 2019
STATUS
approved