Von Mangoldt function with PARI GP

236 Views Asked by At

How to program the Von Mangoldt function: $$\Lambda (n)=\begin{cases}\log p&{\text{if }}n=p^{k}{\text{ for some prime }}p{\text{ and integer }}k\geq 1,\\0&{\text{otherwise.}}\end{cases}$$

with PARI/GP.Thank you.

1

There are 1 best solutions below

0
On BEST ANSWER

An implementation for the function in Pari/GP:

Mangoldt(n)={ispower(n,,&n);if(isprime(n),log(n),0)};

For the exponential of Mangoldt function A014963 type:

A014963(n)={round(exp(Mangoldt(n)))};