Quote:
Originally Posted by enzocreti
19 (a twin) is the smallest prime such that between it and the closest square surrounding it (16) there is a prime 17.
Another example is 41...between 41 and 36 there is 37. (36 is the closest square surrounding 41, being 7^2 further away than 6^2).
89 is the first non twin prime with this property, any Others?

For each positive integer n, the interval closest to n^2 on the left is [n^2  n + 1, n], and closest on the right is [n^2, n^2 + n].
For each n > 1, there is one largest prime p < n^2, and one smallest prime q > n^2.
So, for each n > 1, there is at most one prime closest to n^2 on the left and one closest on the right.
There could of course be duplications, in that the smallest prime q > n^2 could be the same as the largest prime < (n+1)^2. It is also possible as far as we know (though no examples are known, and nobody actually believes there are any) that there is an n for which there are no primes between n^2 and (n+1)^2.
It is also possible (though I know of no examples) that the largest square less than n^2 (for n > 1) is closer to (n1)^2 than to n^2, or the least prime greater than n^2 is closer to (n+1)^2 than to n^2.
In any case, there are at most about 2*sqrt(X) primes less than X which are closest to some square. There are about X/log(X) primes less than X, so for all but an infinitesimal proportion of primes p, there will be some prime closer to the nearest square than p is.
The largest square for which there is a
unique prime on the left closer to it than to the preceding square appears to be 11^2 = 121, the prime being p = 113. (The prime before 113 is 109, which is closer to 100 than to 121.) The largest square for which there is a
unique prime on the right closer to it than to the next square appears to be 17^2 = 289, the prime q being 293. (The next prime after 293 is 307, which is closer to 18^2 than to 17^2.)