Tuesday, 18 April 2023

Pandigital Primes

  

No reason for Wells' book on the cover, I just like the picture.  (and his writing)

In mathematics, a pandigital number is an integer that in a given base has among its significant digits each digit used in the base at least once. In base ten such a number might be 123456789098765444321.  If the number is prime, which is really cool, it is called a pandigital prime.  And if it uses the digits exactly once each, which is even cooler, .... Unfortunately, in base ten,  which is where a lot of us hang out the most, you can't have such a number.  Any ordering of 1,2,3,4,5,6,7,8,9,and 0 will be divisible by three, and hence - NOT prime.  Even if you leave out the zero, you can't make one with the first nine digits either for the same reason.( I know..."Ahhhhh".)(But you can have all of 1 through 9 if the tenth digit is not zero but 1, ....  1234567891 is Prime.)

So there are a couple of ways to adjust.  We can look for primes that are n digits long and use the first n numerals, for example 2143 is a four digit prime using the numerals 1,2,3, and 4.  The problem with this approach is that there are only two of them.  The four digit one is shown, and a seven digit one is 7652413 . Any number made up of the first  2, 3, 5, 6, 8, 9, or ten digits will be divisible by three.

That leaves a couple of options.  I got started thinking about these when I wrote a blog awhile back called "The Game of Primes ."  The object was to create a string of primes by starting with one prime number and then adding a digit each time to make the string a longer prime, but using any of the ten decimal numerals as a digit.  So you could start with 2, then add 3 to get 23, etc.  I only got to seven, you may be able to do better.  There is a nine digit prime (several of them) that has no repeated numerals.  I found 576849103 is prime  and  so is 987654103.  Having pretty much reached the ends of my manual calculating limits, I asked on twitter, "Is there a nine digit prime using distinct digits that includes a two?"
Faster than a nano-bullet I got a response from jomo ‏ @n0m0 who advised me that "First nine digit prime with distinct digits that includes number 2 is 102345689, second is 102345697 and so on again!"  

Realizing I had a computation wizard on the line (at least relative to me) I wondered aloud, (or Atweet) 
"Is it possible to form an eleven digit Pandigital Prime (ie repeating only one of the 0-9)"  Again at something akin to the speed of light,  he responded with two examples; "First pandigital prime with 11 digits is 10123457689, next one is 10123465789 and so on..." 

Then, realizing he had a rube on line whose non-programming nose could easily be pushed in the mud, he sent me a list of several... you can count them, and lock this away if you are looking for 11-digit primes... 

Here is the first few, but the whole list he has graciously placed here.  List of 11 digit pandigital primes filtered from ~10 million primes

10123457689
10123465789
10123465897
10123485679
10123485769
10123496857
10123547869
10123548679
10123568947
10123578649
10123586947
10123598467
10123654789
10123684759
10123685749
10123694857
10123746859
10123784569
10123846597
10123849657
10123854679
10123876549
10123945687
10123956487
10123965847
10123984657
10124356789
10124358697
10124365879
10124365987

No comments: