Persistent and n-persistent numbers. (Recreational computing) Michael W. Ecker.
A while back, Ripley's Believe It Or Not published an interesting "fact" about a certain many-digited number. Upon investigation, this "fact" proves to be no fact at all. But it does raise some intriguing questions, and, with a little computer play or math, we can get into this month's challenges.
Let's start with an example. Consider the number 5882352941176470. Notice that each of the ten digits appears at least once. Suppose we now multiply this number by 1, or 2, by 3, or 4, or . . . (and so on). Does each of the ten digits appear at least once in the product?
The program in the listing will answer this question--barely. In general, note that one potential difficulty in proceeding is the lack of computer precision for handling so many digits. You would therefore need, for still bigger numbers, to break the big number up--technically, using the distributive property--and multiply each "part" by your 2 (or 3, or 4, whichever you were doing). Then you reassemble the results. Such an ultraprecision multiplication program would allow you to test even larger numbers by taking the digits and creating strings, doing arithmetic on each digit, and then printing out the string representing the product.
Now type in and run the program using the large number above. Notice that for quite a few integers, 1, 2, 3, 4, . . . the product in question does contain at least one of each digit. This is somewhat fascinating--and encouraging.
But then the pattern is lost as you suddenly get an answer consisting of a string of 9's followed by a final 0. This is somewhat discouraging.
Let's get back to Ripley's and its error. It said: take any natural number (1, 2, 3, . . . ad infinitum) and multiply it by a specific, special number. The resulting product--regardless of which multiplier is used--allegedly contains at least one of each of the ten digits 0 through 9. They call this special number a persistent number.
If there were such a number, it would have to have at least ten digits, because it times 1 would have to have at least one of each digit. In fact, no such number could possibly exist. I tell you this right away so that you don't waste fruitless hours searching for a persistent number.
This is precisely the error made in Ripley's Believe It Or Not--so don't believe it. Rather than offer or outline a mathematical proof that no persistent number exists, we can experiment with the program by modifying it. We still would like a multiprecision mutliplication program, and I hope to have one in an upcoming issue. I also located one in Computers in Mathematics: A Sourcebook for Ideas, edited by our own David H. Ahl and available through Creative Computing. This is a nice book to have anyway!
The results can never be conclusive when you just test many examples, but they will be more down to earth. Please try it to persuade yourself. For readers who wish more certainty and to see an elegant mathematical proof, please send me two quarters and a self-addressed, stamped envelope. Indicate that it is for the explanation as to why a persistent number cannot possibly exist.
Okay, so persistence is a dead issue. Can we modify this to salvage something interesting? In a word, yes. We saw that the number I provided earlier has a "partial persistence" property, using only the multipliers 1 through 16. We could say that the number 5882352941176470 is 16-persistent (but not 17-persistent). This is what I did in Crux Mathematicorum, a Canadian mathematics problem solving journal, just a few years ago. I defined a natural number as being n-persistent if it is true that the number itself times any one of 1, 2, . . . , n (that is, up to n) yields a product containing each digit at least once.
I haven't told you how I cooked up the special 16-persistent number above. There is an elegant connection of this to the question of certain kinds of prime numbers, but space considerations require that I defer that association--at least until next month. The question before you is: For which values of n do n persistent numbers exist? When we go into this association more, we'll also get into how to discover such a number in the first place.
Time to go again. I invite everybody to try the challenges: come up with your own solutions and your own problems. If I use your ideas, your role will be acknowledged in this column. You may write to me directly at 129 Carol Dr., Clarks Summit, PA 18411.
Until next month, happy recreational computing!