[go: up one dir, main page]

login
A185052
Nearest prime to (prime(n)/2)^4.
1
2, 5, 41, 151, 919, 1787, 5227, 8147, 17491, 44207, 57719, 117133, 176611, 213659, 304981, 493159, 757331, 865363, 1259429, 1588231, 1774901, 2434381, 2966141, 3921383, 5533067, 6503771, 7034429, 8192473, 8822377, 10190473, 16259017, 18406229, 22017199
OFFSET
1,1
COMMENTS
Nearest prime program by Ignacio Grande in LinkedIn Mathematica users group as answer to my question.
LINKS
MAPLE
f:= proc(n) local x, q, r, v;
x:= (ithprime(n)/2)^4;
q:= nextprime(floor(x));
r:= prevprime(ceil(x));
v:= (q+r)/2;
if v > x then r else q fi
end proc:
f(1):= 2:
map(f, [$1..50]); # Robert Israel, Aug 04 2019
MATHEMATICA
nearestPrime[n_Integer] := Module[{n2}, n2 = (Prime[n]/2)^4;
If[n2 < 2, {2}, Nearest[Prime[PrimePi[n2] + {0, 1}], n2, 1]][[1]]]; nearestPrime /@ Range[20]
CROSSREFS
Cf. A186732.
Sequence in context: A286560 A002592 A054553 * A088547 A009457 A175172
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, Jan 22 2012
STATUS
approved