Pari GP 中的素数计数函数

Prime counting function in Pari GP

素数计数函数pi(x) 计算小于x 的素数个数。由于 Pari 非常适合处理质数,我认为这个功能会被实现,但我在文档中没有找到任何内容。

  • Is pi(x) already implemented in Pari GP?
  • If not, is it possible to find the index of a prime? I know the command prime(n) returns the n'th prime? (If it is possible to find this quickly then this combined with precprime could do the trick.)

它是 primepi,如:

primepi(10^6)

(returns 78498)