Michael Kleber <michael.kleber@gmail.com> wrote:
Nice table, Keith!
Thanks.
I have little to offer, but at least my copy of Mathematica can answer one of your questions by brute force: The first prime that doesn't divide any of the 10! base-10 pandigitals is apparently 111119.
Thanks, though that wasn't actually one of my questions.
(Computing the 10! prime factorizations took under a minute.)
Likewise. But it gets much slower for each higher base. Also, if I were ever to go beyond base 16, I could no longer use 64-bit integers, which would create an additional slowdown.
(I guess doing the composite-numbered rows would involve some factor/round/max logic that I haven't written but isn't hard.)
Since I only bothered to go through powers of 16 (to make the table square, given that I stop at base 16), I hand-coded that (in C): if (p[i] == 2) { n[4] = n[2]/2; n[6] = min(n[2],n[3]); n[8] = n[2]/3; n[10] = min(n[2],n[5]); n[12] = min(n[3],n[4]); n[14] = min(n[2],n[7]); n[16] = n[2]/4; } if (p[i] == 3) { n[6] = min(n[2],n[3]); n[9] = n[3]/2; n[12] = min(n[3],n[4]); n[15] = min(n[3],n[5]); } if (p[i] == 5) { n[10] = min(n[2],n[5]); n[15] = min(n[3],n[5]); } if (p[i] == 7) { n[14] = min(n[2],n[7]); } Had I been lazy, I could have simply tried repeatedly dividing the pandigital number by each of the composite numbers.
To find the first 0 in the column, i.e. the first missing prime: For[n=1, maxpower[Prime[n]] > 0, n++, Null] {n, Prime[n]} (* Answer: {10545, 111119} *)
I see that Mathematica starts counting with 1, not 0. (If 111119 is prime 10545, then 2 is prime 1, not prime 0.)
The first zero in the base-6 column is 229, and in base-8 is 4663.
Confirmed. Starting with base-2, I get 3,2,17,67,229,2,4663,.... Since 111119 is an interesting-looking number in base 10, I looked at those other numbers in the bases they go with: 11,2,101,232,1021,2,11067. Not very interesting. But your 3257447 is 111111B in base 12. That can't be a coincidence. (Well, it can, but it's very unlikely.) What prime do you get for base 9, and what does it look like in that base?
None of this counts as "efficient", certainly, since the work grows as worse than the factorial of the base.
Indeed.
For base 12, I had to change my Mathematica thing to not materialize all those lists of 12! things all at once, since they wouldn't fit in memory.
It would never even occur to me to try to put them in memory. I deal with each pandigital number one at a time. My actual question was:
For each column, especially base 10, where's the first zero, i.e. the smallest number that no N-digit base-N pandigital number is divisible by?
That's a much easier question, as the answer can't exceed N^2. The answers are 3,2,16,4,36,2,64,8,100,2,144,4,... I wonder if the answer is always N^2 for even values of N other than 2. And if it's ever N^2 for odd values of N. For odd N does it ever exceed N itself?