# Prime Bases and Nice Numbers

For Context, @Conflux has this market about what he terms "nice numbers" or numbers in a base such that the square and the cube together use all of the digits exactly once. Also, see this market where I made the pre-commitment to create this post! Anyways, here's the post about the density of nice numbers in prime and composite bases!

I've done some research into this, and I've come away with two big observations:

Prime bases have a higher expected density of nice numbers than composite bases.

However, if you are considering numbers in some base b such that the last digit of the square and the cube are different, there is virtually no difference in density between prime and composite b's. And it's easy to only search those, since within a specific residue class mod b, the last digit of the cube never changes, and the last digit of the square never changes.

In other words, if you are going to be searching a base purely randomly, then you are more likely to find a nice number in a prime base than a composite base. However, if you are randomly searching one specific residue in base b, then it doesn't matter matter whether b is composite or prime (assuming that the specific residue has distinct last digits for the square and cube).

You can see uh, "actual backing" for those claims in this overleaf write-up. You can see all the code used to generate the visualizations in this ipynb.