Hacker News new | ask | show | jobs
by dullcrisp 724 days ago
What logic does it use for when to use a +1? One thing I noticed: if I give it 100,000 it gives me 2^5•5^5. But if I give it 100,001, instead of 2^5•5^5+1, it gives (2•5 + 1)•(2•3^2•5•(2^2•5^2 + 1) + 1), which seems sub-optimal.
1 comments

It only uses the +1 for prime numbers. 100,001 is not prime.

This rule ensures that there is a unique representation for every number.

Fantastic! Thank you for explaining this.