Ramanujan primes: Difference between revisions

Some modifications in function "ramanujanPrime".
(→‎{{header|Phix}}: replaced with faster version)
(Some modifications in function "ramanujanPrime".)
Line 410:
 
proc ramanujanPrime(pi: PrimeCounter; n: int): int =
var max = ramanujanMax(n)
let maxPoss = int(ceil(4 * n.toFloat * ln(4 * n.toFloat)))
if (max and 1) == 1: dec max
for i in countdown(maxPossmax, 12, 2):
if pi[i] - pi[i div 2] < n:
return i + 1
Anonymous user