Function primecount::phi
source · [−]Expand description
Partial sieve function (a.k.a. Legendre-sum).
phi(x, a)
counts the numbers <= x
that are not divisible
by any of the first a
primes.
Returns -1 if an error occurs.
Examples
// The numbers are: 1, 5 and 7.
assert_eq!(primecount::phi(10, 2), 3);
// The numbers are: 1, 7, 11 and 13.
assert_eq!(primecount::phi(15, 3), 4);
assert_eq!(primecount::phi(10i64.pow(12), 78498i64), 37607833521)