Skip to content

Comment on Show HN: Primeval Numbers

Comments

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.

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.