Skip to content

prime_pi for input ~ 10^10 causes PariError #4670

@roed314

Description

@roed314

Calling the primepi function on a large pari integer (10^10) causes an error. The issue is that in sage/libs/pari/gen.pyx the function init_primes casts the input to an unsigned long. If we don't want to allow initialization with input bigger than this, we should give a better error.

sage: prime_pi(10^10)
---------------------------------------------------------------------------
PariError                                 Traceback (most recent call last)

/Users/Roed/Math/sage-3.2/<ipython console> in <module>()

/Users/Roed/Math/sage-3.2/local/lib/python2.5/site-packages/sage/functions/transcendental.pyc in __call__(self, x)
    363             from sage.rings.integer import Integer
    364             pari.init_primes(pari(x)+Integer(1))
--> 365             return ZZ(pari(x).primepi())
    366 
    367     def plot(self, xmin=0, xmax=100, *args, **kwds):

/Users/Roed/Math/sage-3.2/local/lib/python2.5/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:37972)()

PariError: impossible assignment I-->S (23)

Component: number theory

Author: Kevin Stueve

Reviewer: Sebastian Pancratz

Merged: sage-4.3.1.rc1

Issue created by migration from https://trac.sagemath.org/ticket/4670

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions