Legendre prime counting function: Difference between revisions

Content added Content deleted
(Removed memoization from Java solution)
m (Minor edit to C++ and Java code)
Line 81: Line 81:
if (x <= pa)
if (x <= pa)
return 1;
return 1;
return phi(x, a - 1) - phi(x / primes[a - 1], a - 1);
return phi(x, a - 1) - phi(x / pa, a - 1);
}
}


Line 380: Line 380:
if (x <= pa)
if (x <= pa)
return 1;
return 1;
return phi(x, a - 1) - phi(x / primes.get(a - 1), a - 1);
return phi(x, a - 1) - phi(x / pa, a - 1);
}
}