A105016 Smallest a(n) such that a(n)^2 - n is a positive prime, or 0 if no such a(n) exists.
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
Keywords
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.
Links
- T. D. Noe, Table of n, a(n) for n = 0..10000
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 *)
Comments