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.

A105016 Smallest a(n) such that a(n)^2 - n is a positive prime, or 0 if no such a(n) exists.

Original entry on oeis.org

0, 2, 2, 4, 3, 4, 3, 3, 5, 4, 9, 4, 5, 4, 4, 14, 0, 6, 5, 6, 5, 8, 5, 5, 11, 6, 7, 8, 9, 6, 7, 6, 7, 6, 6, 8, 7, 12, 7, 10, 9, 8, 7, 12, 7, 8, 7, 7, 11, 0, 9, 8, 9, 8, 11, 12, 13, 8, 9, 8, 11, 8, 8, 10, 9, 12, 13, 18, 9, 10, 9, 10, 13, 12, 9, 16, 9, 10, 9, 9, 11, 10, 21, 10, 11, 12, 13, 10, 15, 10
Offset: 0

Views

Author

Joshua Zucker, Mar 31 2005

Keywords

Comments

An old ARML problem asked for the smallest n>0 such that a(n) does not exist.

Examples

			a(8) = 5 because 5^2 - 8 = 17 is the smallest square that gives a prime difference.
a(16) = 0 because if x^2 - 16 is prime, then a prime equals (x+4)(x-4), which is impossible.
		

Crossrefs

Cf. A075555 for the primes = a(n)^2 - n.

Programs

  • Mathematica
    Table[s = Sqrt[n]; If[IntegerQ[s], If[PrimeQ[(s + 1)^2 - n], k = s + 1, k = 0], k = Ceiling[s]; While[! PrimeQ[k^2 - n], k++]]; k, {n, 0, 100}] (* T. D. Noe, Apr 17 2011 *)