Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factoring fails for large inputs #84

Open
Mego opened this issue Jul 7, 2017 · 1 comment
Open

Factoring fails for large inputs #84

Mego opened this issue Jul 7, 2017 · 1 comment

Comments

@Mego
Copy link
Owner

Mego commented Jul 7, 2017

Code: :1965593254291461501637330902918203684832716283082y (w produces similar results)

Error:

Traceback (most recent call last):
  File "/opt/actually/seriously/seriously.py", line 231, in eval
    self.fn_table.get(ord_cp437(c), lambda x: x)(self)
  File "/opt/actually/seriously/SeriouslyCommands.py", line 1349, in <lambda>
    0x79:lambda x:x.push(factor(x.pop())),
  File "/opt/actually/seriously/SeriouslyCommands.py", line 579, in factor
    return [a for a,b in full_factor(n)]
  File "/opt/actually/seriously/SeriouslyCommands.py", line 560, in full_factor
    init_primes_up_to(int(rmath.sqrt(n))+1)
  File "/opt/actually/seriously/SeriouslyCommands.py", line 259, in init_primes_up_to
    temp=[1]*(n-max_tested)
OverflowError: cannot fit 'int' into an index-sized integer

The factoring algorithm needs to be more memory-efficient. Perhaps there should be a threshold value set for switching over to a slower-but-memory-efficient algorithm instead of the current somewhat-fast-but-memory-intensive approach.

@kckennylau Any thoughts?

@SIGSTACKFAULT
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants