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!)
A323213 Nearest prime to the median of the primes below 10^n. 0
5, 41, 439, 4523, 46411, 470303, 4751053, 47868179, 481346903, 4834216447, 48507378197, 486425324491, 4875521711327, 48850585043591, 489323461383733, 4900321995437591, 49065251868835099, 491200019422325489, 4916868348839249987, 49212253916770634411 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
Kim Walisch, primecount.
FORMULA
a(n) = prime(floor(A006880(n) / 2) + 1). - David A. Corneth, Mar 19 2019
EXAMPLE
From David A. Corneth, Mar 19 2019: (Start)
There are 25 primes <= 10^2 = 100 so a(2) is the (25 + 1)/2 = 13th prime, being 41.
There are 168 primes <= 10^3 = 1000 so a(3) is the prime closest to the average of prime(84) = 433 and prime(85) = 439. That average is 436, equally distant from both primes. So the largest is chosen. This disables the need to compute the median and we can immediately say that a(3) = prime(168 / 2 + 1) = 439. (End)
MATHEMATICA
a[n_] := Prime[Floor[PrimePi[10^n]/2] + 1]; Array[a, 10] (* Amiram Eldar, Mar 20 2019 *)
PROG
(Julia) using Statistics, Primes
function MedianPrimes(n)
med = Int64(round(median(primes(10^n))))
isprime(med) && return med
prevmed = prevprime(med); nextmed = nextprime(med)
abs(med - prevmed) < abs(med - nextmed) ? prevmed : nextmed end
println([MedianPrimes(n) for n in 1:12])
(PARI) a(n) = pi = primepi(10^n); prime(pi \ 2 + 1) \\ David A. Corneth, Mar 19 2019
CROSSREFS
Sequence in context: A218219 A140095 A259609 * A083073 A115257 A225095
KEYWORD
nonn,more
AUTHOR
Peter Luschny, Mar 19 2019
EXTENSIONS
a(11) from David A. Corneth, Mar 19 2019
a(12)-a(19) using Kim Walisch's primecount, from Amiram Eldar, Mar 20 2019
a(20) from Jinyuan Wang, Nov 14 2020
STATUS
approved

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 23 10:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)