Ask Your Question

# Product of primes not dividing $N$ in SAGE.

Hi, for a given $N,$ I want to compute a product of the type in SageMath

$$\prod_{p\nmid N} \left(1-\frac{1}{p}\right)\left(1+\frac{1}{p}^{-1}\right)$$

For this I need to generate a list of these primes which does not divide $N.$ I do not know any method or command which does that. How can I compute this in sage? Thanks in advance.

edit retag close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

This is a bit ill-defined - the infinitely many such primes? But here is something you can probably modify.

sage: N = 123
sage: prod(1/p for p in set(primes(N)).difference(set(N.prime_factors())))
1/256992314149736648684107368223932215392477130

more

## Comments

Thank you ver much.

( 2017-07-07 22:17:48 +0200 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2017-07-07 00:25:32 +0200

Seen: 528 times

Last updated: Jul 07 '17