login
A246934
The closest square to n-th prime.
2
1, 4, 4, 9, 9, 16, 16, 16, 25, 25, 36, 36, 36, 49, 49, 49, 64, 64, 64, 64, 81, 81, 81, 81, 100, 100, 100, 100, 100, 121, 121, 121, 144, 144, 144, 144, 169, 169, 169, 169, 169, 169, 196, 196, 196, 196, 225, 225, 225, 225, 225, 225, 256, 256, 256, 256, 256, 256, 289, 289, 289, 289
OFFSET
1,2
EXAMPLE
a(5) = 9 because 5th prime is 11, and 11-9<16-11, that is 9 is the closest square to 11.
PROG
(PARI){forprime (p = 2, 300, a = sqrtint (p); b = (a + 1)^2; a = a^2;
s = if (b - p > p - a, a, b); print1 (s ", "))}
CROSSREFS
Sequence in context: A162564 A014694 A065730 * A206919 A168039 A145445
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 02 2014
STATUS
approved