login
A248170
Nonnegative integer whose square is the closest square to prime(n).
2
1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20
OFFSET
1,2
FORMULA
a(n) = sqrt(A246934(n)).
MATHEMATICA
ns[n_]:=Module[{s=Sqrt[n], a, b}, a=Floor[s]; b=Ceiling[s]; If[n-a^2<= b^2- n, a, b]]; ns/@Prime[Range[80]]
Sqrt[#]&/@With[{s=Range[20]^2}, Table[Nearest[s, p], {p, Prime[ Range[ PrimePi[ Max[s]]]]-1}]]//Flatten (* Harvey P. Dale, May 14 2020 *)
PROG
(PARI) {forprime (p = 2, 400, a = sqrtint (p); b = (a + 1)^2; a = a^2;
s = if (b - p > p - a, a, b); print1 (sqrtint (s) ", "))}
CROSSREFS
Sequence in context: A000006 A061017 A331535 * A225545 A088462 A189574
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 03 2014
STATUS
approved