Ask Your Question

Sage kills itself after a while for inputs > 40bits

asked 2016-03-02 22:17:30 -0600

David Wong gravatar image


I implemented Pollard Rho, the first. It takes a few seconds, I would say 30 seconds, for Sage to just get killed. No stack trace. The function works fine with small inputs, but with 40 bits input it just get killed.

if I run it from the command line:

sage application.sage /Applications/sage/src/bin/sage-python: line 2: 34694 Killed: 9 sage -python "$@"

if I run it from inside Sage:

load("application.sage") [1] 35646 killed sage

edit retag flag offensive close merge delete


I found the problem:

for i in range(40_bit_number):

weird that I didn't get a stack trace though

David Wong gravatar imageDavid Wong ( 2016-03-03 00:14:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-03-03 10:19:42 -0600

tmonteil gravatar image

With such a huge range, you should get a MemoryError.

Instead of creating the whole list, you can use the xrange() iterator that generates the numbers one after another without storing them all.

That said, i only get the MemoryError, no crash: could you please give us some informations so that someone can try to reproduce your problem:

  • which version of Sage did you use ?
  • which OS ?
  • did you install Sage from the binaries, and which ones ?
  • did you compile Sage yourself ?
  • which notebook did you use (Sage notebook or jupyter notebook) ?
  • did you use the command line ?
  • which command did you type precisely to get the error ?
  • which error message did you get ?
  • ... ?
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2016-03-02 22:17:30 -0600

Seen: 52 times

Last updated: Mar 03 '16