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

RT #98905: factor and primes are limited to 2^32 #404

Open
briandfoy opened this issue Jan 9, 2024 · 1 comment
Open

RT #98905: factor and primes are limited to 2^32 #404

briandfoy opened this issue Jan 9, 2024 · 1 comment
Labels
Priority: low get to this whenever Program: primes The primes program Type: enhancement improve a feature that already exists

Comments

@briandfoy
Copy link
Owner

From DANAJ in #98905 on rt.cpan.org:

Both factor and primes check that the inputs are 10 or fewer digits and less than 2^32. It is unclear to me whether this is:

  1. intentional behavior that should always be maintained for compatibility.

or

  1. sanity checking the range, and since 64-bit Perl didn't come until after these were written, 32-bit was hard coded.

These are not hard to extend, albeit they're not super speedy for larger numbers, but Ben Tilly wrote some pretty nice code so not nearly as bad as one might expect. I've been playing with alternate primes implementations -- it can be easily sped up 2x for large bases, and I'm sure more than that if we accept lots of turmoil.

For extra credit, we could even use Math::BigInt, but doing that for all inputs while maintaining decent speed might give too much bloat (at least for my coding it would).

@briandfoy briandfoy added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: primes The primes program labels Jan 9, 2024
@briandfoy
Copy link
Owner Author

Hey @mknos, is this one something that you are interested in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: low get to this whenever Program: primes The primes program Type: enhancement improve a feature that already exists
Projects
None yet
Development

No branches or pull requests

1 participant