Primeval number

In recreational number theory, a primeval number is a natural number n for which the number of prime numbers which can be obtained by permuting some or all of its digits (in base 10) is larger than the number of primes obtainable in the same way for any smaller natural number. Primeval numbers were first described by Mike Keith.

The first few primeval numbers are
 * 1, 2, 13, 37, 107, 113, 137, 1013, 1037, 1079, 1237, 1367, 1379, 10079, 10123, 10136, 10139, 10237, 10279, 10367, 10379, 12379, 13679, ...

The number of primes that can be obtained from the primeval numbers is
 * 0, 1, 3, 4, 5, 7, 11, 14, 19, 21, 26, 29, 31, 33, 35, 41, 53, 55, 60, 64, 89, 96, 106, ...

The largest number of primes that can be obtained from a primeval number with n digits is
 * 1, 4, 11, 31, 106, 402, 1953, 10542, 64905, 362451, 2970505, ...

The smallest n-digit number to achieve this number of primes is
 * 2, 37, 137, 1379, 13679, 123479, 1234679, 12345679, 102345679, 1123456789, 10123456789, ...

Primeval numbers can be composite. The first is 1037 = 17×61. A Primeval prime is a primeval number which is also a prime number:
 * 2, 13, 37, 107, 113, 137, 1013, 1237, 1367, 10079, 10139, 12379, 13679, 100279, 100379, 123479, 1001237, 1002347, 1003679, 1012379, ...

The following table shows the first seven primeval numbers with the obtainable primes and the number of them.

Base 12
In base 12, the primeval numbers are: (using inverted two and three for ten and eleven, respectively)
 * 1, 2, 13, 15, 57, 115, 117, 125, 135, 157, 1017, 1057, 1157, 1257, 125Ɛ, 157Ɛ, 167Ɛ, ...

The number of primes that can be obtained from the primeval numbers is: (written in base 10)
 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 20, 23, 27, 29, 33, 35, ...

Note that 13, 115 and 135 are composite: 13 = 3×5, 115 = 7×1Ɛ, and 135 = 5×31.