A Multiplicative Persistance Finder
5/15/19
Edited 3/3/21
I was inspired after watching the numberfile video on 277777788888899. Matt Parker explains muliplicative persistance by starting with a large number, then multipling its digits together to get a new number. the multiplicative resistance of this first number is how many times this proccess can be repeated until a one-digit number is reached.
After watching this video, I had the idea to work backwards, in a way, to find numbers with a large muliplicative resistance value.
For some number, multiply each of the digits together to get the next number. The muliplicative resistance of some number is how many times this process can be done until a 1-digit number is reached.
Every number can only have 1 sum, and that sum can reached by many numbers, factor-based . This relationship can create a tree. This program will take a starting number, and try to create the branches of trees.
The program works like this: given a starting number, the program will find all factor combinations that use 1 digit. It finds every possible ordering of these digits to create new numbers. It recursively runs this program on each of those combinations. These new numbers will have a multiplicative persistance 1 greater than the number started with. Not all numbers will have a factor combination that uses 1 digit numbers, preventing the program from running forever.
I thought I should probably print the numbers in a way that I could easily see their relationships, so I used comma seperated values (csv).
Using this method I started with each number from 1 to 9, and ended the process far below the current record of 11. It follows then, that the final digit-sum for the next record holder must be 0 (277777788888899 does this). Because any number containg a 0 will result in a 0 digit-sum, so there are infinitally many, so instead of runnign my program with a 0 input, I can run through each of these myself and add 1 to the result.
for example, if I start with the number 10 (which has a known multiplicity of 1) the following is returned in the output:
number to start with: 10 ,25 ,55 ,52
You can that for 25 and 52 the sum of their digits is 10. the sum of the digits in 55 is 25. both 55 and 25 do not have any single-digit factorizations so the process stops.
for a more in-depth example, you can download the output for when I start at 6 here
There are inefficiencies with my implementation of this method that I might return to later. This program can be easily multi-threaded, but this was an attempt to learn more about c#.
I learned a lot about c#, but found threading was difficult to implement after the code was written. This code has some places where it could be optimized, but I had limited time to spend on this project. The thing I should add next is a way to pause the operation, save your progress, and return where you left off.
When crunching numbers starting with 20 I was never able to find exciting results due to the depth-first nature of the program. If I ever return to this problem I will re-make the program to be breadth first so I can more easily pause and resume my calculation.