cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

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.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Nov 13 2019

Keywords

Examples

			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.
		

Crossrefs

Programs

  • Mathematica
    Array[Block[{x = 1}, While[! AllTrue[# x + {-1, 1} (# + x), PrimeQ], x++]; x] &, 86, 2] (* Michael De Vlieger, Dec 27 2019 *)
  • PARI
    a(n) = my(x=1); while (!isprime(n*x + n + x) || !isprime(n*x - n - x), x++); x; \\ Michel Marcus, Nov 14 2019
Showing 1-1 of 1 results.