Ask Your Question

Revision history [back]

The problem is that product is the symbolic product, but nth_prime cannot take a symbolic argument.

One could open a ticket to make nth_prime accept symbolic arguments.

To solve the question though, the easiest is to use prod and to use a generator and the comprehension syntax.

sage: prod(nth_prime(x) for x in (2 .. 3))
15

The problem is that product is the symbolic product, but nth_prime cannot take a symbolic argument.

One could open a ticket to make nth_prime nth_prime accept symbolic arguments.

To solve the question though, the easiest is to Or use prod and to use a generator and the with comprehension syntax.syntax:

sage: prod(nth_prime(x) for x in (2 .. 3))
15

Related ticket: