Write 25 in binary: 11001. Interpret that as if it was in ternary: 3⁴+3³+1 = 109...

@christianp@mathstodon.xyz

Write 25 in binary: 11001.
Interpret that as if it was in ternary: 3⁴+3³+1 = 109, a prime number!

What other composite numbers does it work for?

I quickly realised that it has to be odd, and furthermore, has to give an irreducible polynomial if you interpret it in base x (e.g. 11001 →𝑥⁴+𝑥³+1).

Is that all that needs to happen?

The numbers that work when you do this are:
25, 55, 69, 77, 81, 87, 91, 115, 117, 121, 143, 145, 169, 171, 185, ...

This seems to be exactly A206075 in the #OEIS: oeis.org/A206075.

Can someone who knows number theory tell me why?

And if there is one, can anyone find a number where you have to interpret it as a bigger base than 3 to get a prime?