Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAMe too @Chris-Nienart ! 🤣🤣🤣
my lucky number is 7️⃣
I wanted a real challenge, so i did not use the start file and built everything based on the original post descriptions.
The results are as follows:
Task 1: Validate the process that all four-digit integer numbers with at least two distinct digits will transform into 6174 when applying the rules of Kaprekar’s constant.
Result: See Week406 Output, all numbers verified. There are 8991 qualifying numbers.
Task 2: Find the highest and the lowest number of iterations you need to transform any four-digit number into 6174 using this rule set.
Result: Highest is 7, lowest is 1.
Task 3: Determine your lucky number.
Result: 2
What is not obvious from the original question is that when you calculate the difference in step 3, the result need to be converted to 4 digits. For example, 1000 - 0001 = 999. More accurately, it is 0999. Thus, when you perform the next iteration, the number is 9990 - 0999 = 8991.
It is necessary for the larger number to always be a 4 digit number. If it is less than 4 digits, 0's need to be added to the end for this to work.
Solution image:
Batch Macro
Iterative Macro
In addition to these, I built 2 standard macros, as I did not rely on RegEx, so parsing macros were created instead.