Showing posts with label smallest. Show all posts
Showing posts with label smallest. Show all posts

Wednesday, 23 April 2025

Descent to Zero

The number associated with my diurnal age today, \( \textbf{27779} \), has the interesting property that it is the smallest number that takes 22 steps to reach 0 under "\(k \rightarrow \) max product of two numbers whose concatenation is \(k\)". The possible concatenatable pairs and their products for 27779 are:

  • 2 * 7779 = 15558
  • 27 * 779 = 21033
  • 277 * 79 = 21883
  • 2777 * 9 = 24993
We see that 24993 is the maximum product and we repeat the process using this number as our starting point:

  • 2 * 4993 = 9986
  • 24 * 993 = 23832
  • 249 * 93 = 23157
  • 2499 * 3 = 7497
The maximum product is 23832 and so this becomes the new number and the process continues until we reach 0 after 22 steps. The progression is as follows (permalink):

27779, 24993, 23832, 19136, 11478, 9176, 6916, 5496, 5184, 4284, 3528, 2816, 1686, 1376, 988, 792, 644, 264, 128, 96, 54, 20, 0


27779 is a member of OEIS A035932: smallest number that takes \(n\) steps to reach 0 under "\( k \rightarrow \) max product of two numbers whose concatenation is \(k\)". The initial members of this sequence are:

0, 1, 11, 26, 39, 77, 117, 139, 449, 529, 777, 1117, 2229, 2982, 4267, 4779, 5319, 5919, 8693, 12699, 14119, 17907, 27779, 47877, 80299, 103199, 135199, 274834, 293938, 312794, 606963, 653993, 773989, 1160892, 1296741, 1616696, 1986576

This permalink will check for the smallest number once the number of steps is specified. When writing the code the convention is that you add a condition to handle single-digit numbers. A common rule for sequences like this that aim to reach 0 is that single-digit numbers (other than 0) map to 0 in the next step. So looking at the above sequence we see following progressions to 0 beginning with 0 that requires zero steps (permalink):
  • 0
  • 1, 0
  • 11, 1, 0
  • 26, 12, 2, 0
  • 39, 27, 14, 4, 0
  • 77, 49, 36, 18, 8, 0
  • 117, 77, 49, 36, 18, 8, 0
  • 139, 117, 77, 49, 36, 18, 8, 0
  • 449, 396, 288, 224, 88, 64, 24, 8, 0
  • 529, 468, 368, 288, 224, 88, 64, 24, 8, 0
  • 777, 539, 477, 329, 288, 224, 88, 64, 24, 8, 0
  • 1117, 777, 539, 477, 329, 288, 224, 88, 64, 24, 8, 0
  • 2229, 1998, 1862, 1116, 666, 396, 288, 224, 88, 64, 24, 8, 0
  • 2982, 2378, 1896, 1728, 1376, 988, 792, 644, 264, 128, 96, 54, 20, 0

Friday, 19 April 2024

Unleashing the Full Potential of SageMath


My new M1 Macbook Air is already proving its usefulness as I discovered when exploring the properties of the number associated with my diurnal age today, namely 27401. This number has a property that qualifies it for membership in OEIS 
A197816:


 A197816

Smallest composite number \(m\) such that \(m\) and the greatest prime divisor of \(m\) begin with \(n\).



It took me a while to fully understand what this property involved. Once I did, I developed the algorithm in SageMathCell that is shown in Figure 1 (permalink).


Figure 1

However, the operation times out in SageMathCell which is simply an online implementation of SageMath. In the past, when I used the installation of SageMath on my laptop to address this problem, the laptop would generally freeze up and I would have to reboot it. This laptop was a 2013 Macbook Pro that was clearly not capable of handling the calculations. 

The problem with the algorithm is that after a new value of \(m\) is discovered for a given \(n\), the value of \(n\) needs to reset to 4 every time. This needs to be done 299 times and some of the values for \(m\) are quite large. For example, for \(n\)=114 , the value of \(m\) is 114110. Happily my M1 Macbook Air had no difficulty with the calculation and, after 39 seconds, it spat out the numbers for \(n\) up to 299. Here is the output:

102, 203, 36, 410, 50, 603, 70, 801, 970, 1010, 110, 1270, 130, 1490, 1510, 1630, 170, 1810, 190, 20030, 2110, 2230, 230, 2410, 2510, 2630, 2710, 2810, 290, 3070, 310, 32030, 3310, 3470, 3530, 3670, 370, 3830, 3970, 4010, 410, 4210, 430, 4430, 4570, 4610, 470, 4870, 4910, 5030, 51010, 5210, 530, 5410, 5570, 5630, 5710, 5870, 590, 6010, 610, 62030, 6310, 6410, 6530, 6610, 670, 6830, 6910, 7010, 710, 7270, 730, 7430, 7510, 7610, 7730, 7870, 790, 8090, 8110, 8210, 830, 84190, 8530, 8630, 8770, 8810, 890, 9070, 9110, 9290, 9370, 9410, 9530, 9670, 970, 9830, 9910, 10090, 1010, 10210, 1030, 10490, 10510, 10610, 1070, 10870, 1090, 11030, 11170, 11230, 1130, 114110, 11510, 11630, 11710, 11810, 11930, 12010, 12130, 12230, 12310, 12490, 12590, 126010, 1270, 12830, 12910, 13010, 1310, 13210, 133090, 134110, 135130, 13610, 1370, 13810, 1390, 14090, 141070, 14230, 14330, 14470, 14510, 146210, 14710, 14810, 1490, 150130, 1510, 15230, 15310, 15430, 15530, 15670, 1570, 15830, 15970, 16010, 16130, 16210, 1630, 164110, 16570, 16630, 1670, 168110, 16930, 17090, 171070, 17210, 1730, 17410, 17530, 176090, 17770, 17830, 1790, 18010, 1810, 18230, 18310, 18470, 185030, 18610, 18710, 18890, 189110, 19010, 1910, 192070, 1930, 19490, 19510, 196030, 1970, 19870, 1990, 20030, 20110, 20270, 20390, 204070, 20530, 20630, 207070, 20810, 20990, 210010, 2110, 21290, 21310, 21410, 21530, 21610, 21790, 218030, 219110, 22030, 22130, 22210, 2230, 22430, 22510, 22670, 2270, 22810, 2290, 23090, 23110, 232010, 2330, 23410, 23510, 236030, 23710, 23810, 2390, 240010, 2410, 24230, 24370, 24410, 24590, 24670, 24730, 248090, 249070, 25030, 2510, 25210, 25310, 25430, 25510, 256010, 2570, 258010, 25910, 26090, 26170, 26210, 2630, 26470, 26570, 26630, 26710, 26830, 2690, 27070, 2710, 27290, 27310, 27410, 27530, 27670, 2770, 27890, 27910, 28010, 2810, 282010, 2830, 28430, 28510, 28610, 28790, 28870, 28970, 29030, 29170, 29270, 2930, 294010, 29530, 29630, 29710, 298030, 29990

Thus 27410 is the first number that begins with 274 and has a greatest prime divisor (2741) that also begins with 274. As the OEIS comments state: a majority of numbers are divisible by 10. SageMathCell is a great online resource and most of the time, for the calculations I carry out, it is sufficient but it's nice to know that for more protracted calculations, the SageMath installation on my laptop can now be relied upon.