login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A185052 Nearest prime to (prime(n)/2)^4. 1

%I #14 Aug 04 2019 14:55:39

%S 2,5,41,151,919,1787,5227,8147,17491,44207,57719,117133,176611,213659,

%T 304981,493159,757331,865363,1259429,1588231,1774901,2434381,2966141,

%U 3921383,5533067,6503771,7034429,8192473,8822377,10190473,16259017,18406229,22017199

%N Nearest prime to (prime(n)/2)^4.

%C Nearest prime program by Ignacio Grande in LinkedIn Mathematica users group as answer to my question.

%H Robert Israel, <a href="/A185052/b185052.txt">Table of n, a(n) for n = 1..10000</a>

%p f:= proc(n) local x,q,r,v;

%p x:= (ithprime(n)/2)^4;

%p q:= nextprime(floor(x));

%p r:= prevprime(ceil(x));

%p v:= (q+r)/2;

%p if v > x then r else q fi

%p end proc:

%p f(1):= 2:

%p map(f, [$1..50]); # _Robert Israel_, Aug 04 2019

%t nearestPrime[n_Integer] := Module[{n2}, n2 = (Prime[n]/2)^4;

%t If[n2 < 2, {2}, Nearest[Prime[PrimePi[n2] + {0, 1}], n2, 1]][[1]]]; nearestPrime /@ Range[20]

%Y Cf. A186732.

%K nonn,easy

%O 1,1

%A _Roger L. Bagula_, Jan 22 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 14:32 EDT 2024. Contains 371960 sequences. (Running on oeis4.)