Saturday, 23 August 2025
Fun With Primes and Digit Pairs
Friday, 2 May 2025
A Variation on the Descent to Zero
In my post on the 23rd of April 2025 titled Descent to Zero, I considered the smallest numbers that take a certain number of steps to reach 0 under "\(k \rightarrow \) max product of two numbers whose concatenation is \(k\)". What happens if we change this slightly so that the rule is now "\(k \rightarrow \) max product of two \( \textbf{prime} \) numbers whose concatenation is \(k\)".
This is highly restrictive because only numbers that can be split into a pair of prime numbers in one or more ways are eligible for consideration. For example, 246 is dismissed but 235 is eligible for consideration because it can be split into 23 x 5. Moreover, the process of splitting into primes needs to continue until zero is reached if the number is to be a candidate for the smallest number. Here are the numbers that require from 1 to 9 steps to reach zero:$$1, 22, 55, 115, 235, 475, 3389, 13457, 35743$$The breakdown is as follows:
- Descent of 9 steps to zero: 35743 --> 17229, 3893, 1167, 737, 511, 55, 25, 10, 0
- Descent of 8 steps to zero: 13457 --> 5941, 4705, 235, 115, 55, 25, 10, 0
- Descent of 7 steps to zero: 3389 --> 1167, 737, 511, 55, 25, 10, 0
- Descent of 6 steps to zero: 475 --> 235, 115, 55, 25, 10, 0
- Descent of 5 steps to zero: 235 --> 115, 55, 25, 10, 0
- Descent of 4 steps to zero: 115 --> 55, 25, 10, 0
- Descent of 3 steps to zero: 55 --> 25, 10, 0
- Descent of 2 steps to zero: 22 --> 4, 0
- Descent of 1 step to zero: 1 --> 0
Starting with: 38903Dividing 38903 into prime parts and multiplying gives: 1167Dividing 1167 into prime parts and multiplying gives: 737Dividing 737 into prime parts and multiplying gives: 511Dividing 511 into prime parts and multiplying gives: 55Dividing 55 into prime parts and multiplying gives: 25Dividing 25 into prime parts and multiplying gives: 10Reached: 10
Sunday, 3 September 2023
Some Very Special Sphenic Numbers
Today, having turned 27181 days old and also 3883 weeks old, I discovered that 27181 is a very special number indeed. It is a sphenic number with the property that when its three prime factors are concatenated in any order, the resultant numbers are all prime. The details are as follows:$$27181=7 \times 11 \times 353\\ \text{with the concatenated numbers thus being}\\711353, 735311, 117353, 113537, 353711, 353117$$In my long journey to this numbered day, there has only been one previous numbered day and that was 3311. Its details are as follows:$$3311=7 \times 11 \times 43\\\text{with the concatenated numbers thus being}\\71143, 74311, 11743, 11437, 43711, 43117$$In my long journey from womb to tomb, I'm only likely to encounter one further such numbered day and that is 32153. Its details are:$$ 32153=11 \times 37 \times 79\\ \text{with the concatenated numbers thus being}\\113779, 117937, 371179, 377911, 791137, 793711$$That numbered day falls on Tuesday, April 14th 2037 and I may or may not make it that far. It is shortly after my 88th birthday.
![]() |
| My special sphenic numbers are 3311, 27181 and 32153 |
The other numbers up to one million are 41237, 53977, 86507, 110971, 125069, 208579, 256413, 500981, 543337, 853811, 901949 and 964481. The OEIS comments state that, for quadruply composite numbers, is no term with four distinct prime factors under one hundred million.
Tuesday, 6 June 2023
Two Mystery Sequences
What if you were presented with the following sequence of terms:
9, 18, 27, 36, 45, 54, 63, 72, 99, 198, 297, 396, 495, 594, 693, 792, 999, 1998, 2997, 3996, 4995, 5994, 6993, 7992, 8082, 8172, 8262, 8352, 8442, 8532, 8622, 8712, 8802, 9999, 19998, 29997, 39996, 49995, 59994, 69993, 79992, 80982, 81972, 82962, 83952, 84942, 85932, 86922, 87912, 88902, 99999, 199998, 299997, 399996, 499995, 599994, 699993, 799992, 809982, 819972, 829962, 839952, 849942, 859932, 869922, 879912, 889902, 890802, 891702, 892602, 893502, 894402, 895302, 896202, 897102, 898002
What is the pattern that this sequence is following? At first it looks like we are just generating multiples of 9 because we begin with 9, 18, 27, 36, 45, 54, 63, 72 but after that 99 follows and not 81. However, 99 is followed by its multiples again up to 792 = 8 x 99 after which there is a jump to 999 and the pattern repeats. The jump from the 8th multiple is always to the largest number with the same number of digits as the previous multiples. Thus from 72 we jump to 99 and from 792 we jump to 999. However, 999 then progresses to its 17th multiple, not its 8th, and then jumps to 9999 which then repeats this pattern.
We could keep making up ad hoc rules to account for the terms of this sequence but actually they arise from a fairly simple process:
- start with the number 1
- take this number, reverse it and calculate the absolute difference between the two numbers
- if this difference is greater than zero and greater than any previous difference, then add this difference as a term of the sequence
- proceed to the next number
![]() |
Table 1: permalink |
Monday, 13 March 2023
Rectangles and Squares
If we envisage a semiprime that is not a square number as a rectangle then a number like 15 that is equal to 3 x 5 could be represented as shown in Figure 1:
Figure 1: created using Geoboard |
15, 65, 77, 87, 141, 247, 301, 335, 481, 589, 591, 671, 717, 767, 785, 1007, 1167, 1247, 1271, 1351, 1415, 1501, 1527, 1661, 1937, 1967, 2071, 2077, 2157, 2257, 2317, 2391, 2977, 3007, 3047, 3101, 3197, 3215, 3439, 3997, 4061, 4087, 4237, 4385, 4487, 4607, 4829, 4927, 5111, 5777, 6031, 6077, 6161, 6487, 6497, 6541, 6557, 6751, 6927, 7087, 7265, 7341, 7357, 7361, 7967, 8189, 8479, 8557, 9217, 9271, 9287, 9517, 9991, 10077, 10157, 10231, 10727, 11041, 11327, 12209, 12687, 12877, 12989, 13511, 13847, 14317, 14397, 15007, 15185, 15917, 16081, 16397, 16769, 16897, 16957, 17711, 17951, 18141, 18157, 18527, 18807, 19117, 19127, 19367, 19511, 19679, 19741, 19757, 20017, 20191, 20567, 20687, 20711, 20877, 21041, 21421, 21697, 23015, 23231, 23377, 23389, 23729, 23839, 24727, 24737, 24887, 24961, 25341, 25661, 25837, 25967, 25985, 26797, 26909, 27341, 27661, 28247, 28417, 29047, 29135, 29431, 30237, 30311, 30461, 30847, 31597, 31681, 32047, 32551, 32567, 32847, 33527, 34207, 34241, 34647, 34951, 35249, 35741, 35807, 36077, 36391, 36737, 37327, 37437, 37777, 38081, 38191, 38407, 38551, 38687, 39421, 39665
![]() |
Figure 3: created using Geoboard |
square half-square rectangle semiprime 16 8 [5, 3] 15 36 18 [13, 5] 65 36 18 [11, 7] 77 64 32 [29, 3] 87 64 32 [19, 13] 247 100 50 [47, 3] 141 100 50 [43, 7] 301 100 50 [37, 13] 481 100 50 [31, 19] 589 144 72 [67, 5] 335 144 72 [61, 11] 671 144 72 [59, 13] 767 144 72 [53, 19] 1007 144 72 [43, 29] 1247 144 72 [41, 31] 1271 196 98 [79, 19] 1501 196 98 [67, 31] 2077 196 98 [61, 37] 2257 256 128 [109, 19] 2071 256 128 [97, 31] 3007 256 128 [67, 61] 4087 324 162 [157, 5] 785 324 162 [151, 11] 1661 324 162 [149, 13] 1937 324 162 [139, 23] 3197 324 162 [131, 31] 4061 324 162 [109, 53] 5777 324 162 [103, 59] 6077 324 162 [101, 61] 6161 324 162 [89, 73] 6497 324 162 [83, 79] 6557 400 200 [197, 3] 591 400 200 [193, 7] 1351 400 200 [181, 19] 3439 400 200 [163, 37] 6031 400 200 [157, 43] 6751 400 200 [139, 61] 8479 400 200 [127, 73] 9271 400 200 [103, 97] 9991 484 242 [239, 3] 717 484 242 [229, 13] 2977 484 242 [223, 19] 4237 484 242 [211, 31] 6541 484 242 [199, 43] 8557 484 242 [181, 61] 11041 484 242 [163, 79] 12877 484 242 [139, 103] 14317 576 288 [283, 5] 1415 576 288 [281, 7] 1967 576 288 [277, 11] 3047 576 288 [271, 17] 4607 576 288 [269, 19] 5111 576 288 [257, 31] 7967 576 288 [251, 37] 9287 576 288 [241, 47] 11327 576 288 [229, 59] 13511 576 288 [227, 61] 13847 576 288 [199, 89] 17711 576 288 [191, 97] 18527 576 288 [181, 107] 19367 576 288 [179, 109] 19511 576 288 [157, 131] 20567 576 288 [151, 137] 20687 576 288 [149, 139] 20711 676 338 [331, 7] 2317 676 338 [307, 31] 9517 676 338 [277, 61] 16897 676 338 [271, 67] 18157 676 338 [241, 97] 23377 676 338 [229, 109] 24961 676 338 [211, 127] 26797 676 338 [199, 139] 27661 676 338 [181, 157] 28417 784 392 [389, 3] 1167 784 392 [379, 13] 4927 784 392 [373, 19] 7087 784 392 [349, 43] 15007 784 392 [331, 61] 20191 784 392 [313, 79] 24727 784 392 [283, 109] 30847 784 392 [241, 151] 36391 784 392 [229, 163] 37327 784 392 [211, 181] 38191 784 392 [199, 193] 38407 900 450 [443, 7] 3101 900 450 [439, 11] 4829 900 450 [433, 17] 7361 900 450 [431, 19] 8189 900 450 [421, 29] 12209 900 450 [419, 31] 12989 900 450 [409, 41] 16769 900 450 [397, 53] 21041 900 450 [389, 61] 23729 900 450 [383, 67] 25661 900 450 [379, 71] 26909 900 450 [367, 83] 30461 900 450 [353, 97] 34241 900 450 [349, 101] 35249 900 450 [347, 103] 35741 900 450 [337, 113] 38081 1024 512 [509, 3] 1527 1024 512 [499, 13] 6487 1024 512 [439, 73] 32047 1024 512 [433, 79] 34207 1156 578 [571, 7] 3997 1156 578 [547, 31] 16957 1156 578 [541, 37] 20017 1156 578 [499, 79] 39421 1296 648 [643, 5] 3215 1296 648 [641, 7] 4487 1296 648 [631, 17] 10727 1296 648 [619, 29] 17951 1296 648 [617, 31] 19127 1296 648 [607, 41] 24887 1296 648 [601, 47] 28247 1296 648 [587, 61] 35807 1444 722 [719, 3] 2157 1444 722 [709, 13] 9217 1444 722 [691, 31] 21421 1600 800 [797, 3] 2391 1600 800 [787, 13] 10231 1600 800 [769, 31] 23839 1600 800 [757, 43] 32551 1764 882 [877, 5] 4385 1764 882 [863, 19] 16397 1764 882 [859, 23] 19757 1764 882 [853, 29] 24737 1764 882 [839, 43] 36077 1936 968 [937, 31] 29047 2116 1058 [1051, 7] 7357 2116 1058 [1039, 19] 19741 2116 1058 [1021, 37] 37777 2304 1152 [1129, 23] 25967 2304 1152 [1123, 29] 32567 2500 1250 [1237, 13] 16081 2500 1250 [1231, 19] 23389 2916 1458 [1453, 5] 7265 2916 1458 [1451, 7] 10157 2916 1458 [1447, 11] 15917 2916 1458 [1439, 19] 27341 3136 1568 [1549, 19] 29431 3364 1682 [1669, 13] 21697 3364 1682 [1663, 19] 31597 3600 1800 [1789, 11] 19679 3600 1800 [1787, 13] 23231 3600 1800 [1783, 17] 30311 4096 2048 [2029, 19] 38551 4356 2178 [2161, 17] 36737 4624 2312 [2309, 3] 6927 4900 2450 [2447, 3] 7341 4900 2450 [2437, 13] 31681 5184 2592 [2579, 13] 33527 5476 2738 [2731, 7] 19117 6084 3042 [3037, 5] 15185 6724 3362 [3359, 3] 10077 7056 3528 [3517, 11] 38687 7396 3698 [3691, 7] 25837 8464 4232 [4229, 3] 12687 9216 4608 [4603, 5] 23015 9604 4802 [4799, 3] 14397 10000 5000 [4993, 7] 34951 10404 5202 [5197, 5] 25985 11664 5832 [5827, 5] 29135 12100 6050 [6047, 3] 18141 12544 6272 [6269, 3] 18807 13924 6962 [6959, 3] 20877 15876 7938 [7933, 5] 39665 16900 8450 [8447, 3] 25341 20164 10082 [10079, 3] 30237 21904 10952 [10949, 3] 32847 23104 11552 [11549, 3] 34647 24964 12482 [12479, 3] 37437
sphenic factors SA cube side SA 374 2 * 11 * 17 486 9 486 710 2 * 5 * 71 1014 13 1014 3110 2 * 5 * 311 4374 27 4374 3590 2 * 5 * 359 5046 29 5046 4454 2 * 17 * 131 5046 29 5046 6182 2 * 11 * 281 7350 35 7350 7190 2 * 5 * 719 10086 41 10086 8911 7 * 19 * 67 3750 25 3750 9494 2 * 47 * 101 10086 41 10086 10502 2 * 59 * 89 11094 43 11094 10507 7 * 19 * 79 4374 27 4374 11798 2 * 17 * 347 13254 47 13254 18518 2 * 47 * 197 19494 57 19494 18854 2 * 11 * 857 22326 61 22326 20390 2 * 5 * 2039 28566 69 28566 24134 2 * 11 * 1097 28566 69 28566 27559 7 * 31 * 127 10086 41 10086
Thursday, 9 February 2023
In the Vicinity of Cubic Numbers
In searching for properties of the number associated with my diurnal age, 26975, I noticed that the difference between this number and the nearest cubic number is 25 and that 25 divides 27000 (the nearest cubic number) to give 1080. I got to thinking about how many numbers, in the range up to 40,000, have this property.
Well, it turns out that 711 numbers do. A list of them is included at the end of this post. These numbers are not evenly distributed. They tend to cluster around cubic numbers with a large number of divisors and are sparsest around cubic numbers that are the cubes of primes. Figure 1 shows a list of the numbers from 1 to 35, together with their cubes and the numbers of both their divisors.
![]() |
Figure 1: permalink |
The graph of the 711 numbers is interesting, displaying a sinuous pattern. See Figure 2.
![]() |
Figure 2: permalink |
![]() |
Figure 3: permalink |
Notice how the graph is the same shape as that of \(y=x^3\). Next look at the cubic number 29791 that is the cube of 31. The former has four divisors (1, 31, 31 x 31 and 31 x 31 x 31) while the latter has two (1 and 31). The plot is shown in Figure 4 for the range from 28791 to 30791.
![]() |
Figure 4: permalink |
There are only six numbers and these are 28830, 29760, 29790, 29792, 29822, 30752. The numbers immediately preceding and succeeding the cubic number will always qualify since the difference is 1. Thus 26970 and 26972 are represented. Numbers with a difference of 31 will qualify and thus 26760 and 29822 are represented. Numbers with a difference of 31 x 31 will qualify and thus 28830 and 30752 are represented.
An interesting fact is that is that the difference not only divides the cubic number, it also always divides the number itself. For example, in the case 26975, the difference of 25 between 26975 and 27000 also divides 26975. To see why this is so, let's consider a cubic number \(c^3\) and a number \(n<c^3\) such that:
$$
\begin{align} \frac{c^3}{c^3-n} = k \text{ with integer }k>0\\
kc^3-kn =c^3\\
kn=kc^3-c^3\\
kn=c^3(k-1)\\
n=\dfrac{c^3}{k} (k-1) \\
n= \text{ difference } \times (k-1) \end{align}
$$Hence \(n\) is always divisible by the difference. Take \(n=26975\) as an example. $$ \begin{align} \frac{27000}{25} &=1080\\26975=25 \times (1080-1) &=25 \times 1079 \end{align}$$A similar proof can be concocted for the case where \(n>c^3\). Here is the list of the 711 numbers (permalink).
2, 4, 6, 7, 9, 10, 12, 18, 24, 26, 28, 30, 36, 48, 56, 60, 62, 63, 65, 66, 68, 72, 80, 100, 120, 124, 126, 130, 150, 180, 189, 192, 198, 204, 207, 208, 210, 212, 213, 214, 215, 217, 218, 219, 220, 222, 224, 225, 228, 234, 240, 243, 252, 270, 294, 336, 342, 344, 350, 392, 448, 480, 496, 504, 508, 510, 511, 513, 514, 516, 520, 528, 544, 576, 648, 702, 720, 726, 728, 730, 732, 738, 756, 810, 875, 900, 950, 960, 975, 980, 990, 992, 995, 996, 998, 999, 1001, 1002, 1004, 1005, 1008, 1010, 1020, 1025, 1040, 1050, 1100, 1125, 1210, 1320, 1330, 1332, 1342, 1452, 1536, 1584, 1620, 1632, 1656, 1664, 1674, 1680, 1692, 1696, 1701, 1704, 1710, 1712, 1716, 1719, 1720, 1722, 1724, 1725, 1726, 1727, 1729, 1730, 1731, 1732, 1734, 1736, 1737, 1740, 1744, 1746, 1752, 1755, 1760, 1764, 1776, 1782, 1792, 1800, 1824, 1836, 1872, 1920, 1944, 2028, 2184, 2196, 2198, 2210, 2366, 2548, 2646, 2688, 2695, 2716, 2730, 2736, 2737, 2740, 2742, 2743, 2745, 2746, 2748, 2751, 2752, 2758, 2772, 2793, 2800, 2842, 2940, 3150, 3240, 3250, 3300, 3330, 3348, 3350, 3360, 3366, 3370, 3372, 3374, 3376, 3378, 3380, 3384, 3390, 3400, 3402, 3420, 3450, 3500, 3510, 3600, 3840, 3968, 4032, 4064, 4080, 4088, 4092, 4094, 4095, 4097, 4098, 4100, 4104, 4112, 4128, 4160, 4224, 4352, 4624, 4896, 4912, 4914, 4930, 5202, 5508, 5589, 5616, 5670, 5724, 5751, 5760, 5778, 5796, 5805, 5808, 5814, 5820, 5823, 5824, 5826, 5828, 5829, 5830, 5831, 5833, 5834, 5835, 5836, 5838, 5840, 5841, 5844, 5850, 5856, 5859, 5868, 5886, 5904, 5913, 5940, 5994, 6048, 6075, 6156, 6318, 6498, 6840, 6858, 6860, 6878, 7220, 7500, 7600, 7680, 7750, 7800, 7840, 7875, 7900, 7920, 7936, 7950, 7960, 7968, 7975, 7980, 7984, 7990, 7992, 7995, 7996, 7998, 7999, 8001, 8002, 8004, 8005, 8008, 8010, 8016, 8020, 8025, 8032, 8040, 8050, 8064, 8080, 8100, 8125, 8160, 8200, 8250, 8320, 8400, 8500, 8820, 8918, 9072, 9114, 9198, 9212, 9234, 9240, 9252, 9254, 9258, 9260, 9262, 9264, 9268, 9270, 9282, 9288, 9310, 9324, 9408, 9450, 9604, 9702, 10164, 10406, 10527, 10560, 10604, 10626, 10637, 10640, 10644, 10646, 10647, 10649, 10650, 10652, 10656, 10659, 10670, 10692, 10736, 10769, 10890, 11132, 11638, 12144, 12166, 12168, 12190, 12696, 13056, 13248, 13312, 13392, 13440, 13536, 13568, 13608, 13632, 13680, 13696, 13716, 13728, 13752, 13760, 13770, 13776, 13788, 13792, 13797, 13800, 13806, 13808, 13812, 13815, 13816, 13818, 13820, 13821, 13822, 13823, 13825, 13826, 13827, 13828, 13830, 13832, 13833, 13836, 13840, 13842, 13848, 13851, 13856, 13860, 13872, 13878, 13888, 13896, 13920, 13932, 13952, 13968, 14016, 14040, 14080, 14112, 14208, 14256, 14336, 14400, 14592, 14688, 15000, 15500, 15600, 15620, 15624, 15626, 15630, 15650, 15750, 16250, 16900, 17238, 17407, 17472, 17524, 17550, 17563, 17568, 17572, 17574, 17575, 17577, 17578, 17580, 17584, 17589, 17602, 17628, 17680, 17745, 17914, 18252, 18954, 19440, 19602, 19656, 19674, 19680, 19682, 19684, 19686, 19692, 19710, 19764, 19926, 20412, 21168, 21266, 21504, 21560, 21609, 21728, 21756, 21840, 21854, 21888, 21896, 21903, 21920, 21924, 21936, 21938, 21944, 21945, 21948, 21950, 21951, 21953, 21954, 21956, 21959, 21960, 21966, 21968, 21980, 21984, 22001, 22008, 22016, 22050, 22064, 22148, 22176, 22295, 22344, 22400, 22638, 22736, 23548, 24360, 24388, 24390, 24418, 25230, 25875, 25920, 26000, 26100, 26250, 26325, 26400, 26460, 26500, 26550, 26625, 26640, 26700, 26730, 26750, 26775, 26784, 26800, 26820, 26850, 26865, 26875, 26880, 26892, 26900, 26910, 26925, 26928, 26940, 26946, 26950, 26955, 26960, 26964, 26970, 26973, 26975, 26976, 26980, 26982, 26985, 26988, 26990, 26991, 26992, 26994, 26995, 26996, 26997, 26998, 26999, 27001, 27002, 27003, 27004, 27005, 27006, 27008, 27009, 27010, 27012, 27015, 27018, 27020, 27024, 27025, 27027, 27030, 27036, 27040, 27045, 27050, 27054, 27060, 27072, 27075, 27090, 27100, 27108, 27120, 27125, 27135, 27150, 27180, 27200, 27216, 27225, 27250, 27270, 27300, 27360, 27375, 27450, 27500, 27540, 27600, 27675, 27750, 27900, 28000, 28080, 28125, 28350, 28830, 29760, 29790, 29792, 29822, 30752, 31744, 32256, 32512, 32640, 32704, 32736, 32752, 32760, 32764, 32766, 32767, 32769, 32770, 32772, 32776, 32784, 32800, 32832, 32896, 33024, 33280, 33792, 34606, 34848, 35574, 35640, 35816, 35838, 35904, 35910, 35926, 35928, 35934, 35936, 35938, 35940, 35946, 35948, 35964, 35970, 36036, 36058, 36234, 36300, 37026, 37268, 38148, 38726, 39015, 39168, 39236, 39270, 39287, 39296, 39300, 39302, 39303, 39305, 39306, 39308, 39312, 39321, 39338, 39372, 39440, 39593, 39882
Friday, 12 November 2021
Ultramagic Squares
Here is a definition of an ultramagic square:
A magic square is associative if the sum of any two elements symmetric about its center is the same. A magic square is pandiagonal if the sum of the numbers in any broken diagonal equals the magic constant. A magic square is ultramagic if it is associative and pandiagonal. Ultramagic squares exist for orders n>=5. Source.
Using this as a starting point, let's understand what is meant by a pandiagonal magic square. Here is a definition taken from a most useful website:
Pandiagonal magic squares are magic squares, where also the broken diagonals sum to the magic constant. This means when you go off of one edge on a diagonal, continue (wrap-around) to the corresponding cell on the opposite edge. These squares are considered as one of the top classes of magic squares.
Figures 1 and 2 show clearly what is meant by a "broken diagonal" and show a 5 x 5 magic square that is pandiagonal.
![]() |
Figure 1 |
![]() |
Figure 2 |
![]() |
| Figure 3 |
![]() |
Figure 4: source |
![]() |
| Figure 5: source |
![]() |
| Figure 6: source |
![]() |
| Figure 8: source |
A257316 | Smallest magic constant of ultramagic squares of order \(n\) composed of distinct prime numbers. |
- 12249 <=a(9) <=13059
- 4200 <=a(10) <=46150
- a(11) >= 26521
- a(12) >= 8820
- a(13) >= 49439
- a(14) >= 16170
- a(15) >= 74595
- a(16) >= 21840
- Magic Squares on 21st September 2020
- Prime Semi-Magic Squares on 7th May 2021
- Anti-Magic Squares on 17th July 2018
Monday, 23 August 2021
Recursion involving the Totient Function
With plenty of time on my hands and my mind being lately obsessed with recursive processes, I contemplated what might happen if I took a number and added its totient plus one to it, repeating the process with the new number and only terminating when a prime number was reached. Put mathematically and applied to a number \(n\), we have:$$n \rightarrow n+\phi(n)+1$$The first thing to realise is that for any prime number \(p\), this process will yield:$$p \rightarrow p+\phi(p)+1=p+p-1+1=2p$$and so any prime is initially doubled by this process. Remember the totient \( \phi(n) \) of \(n\) is the number of coprime integers less than \(n\), including 1.
Using SageMathCell, I was able to quickly determine the trajectories for all numbers up to 6000 and the distribution is shown in Figure 1. The vertical axis shows the trajectory length while the horizontal axis shows the number. Some of the record trajectories are shown in Figure 1 as well e.g. (97, 152) indicates that the number 97 sets a new trajectory record length of 152.
![]() |
Figure 1: permalink |
Below are shown the numbers that produce trajectories of record length, together with those lengths:
- 1 has a trajectory of record length 1
- 2 has a trajectory of record length 2
- 3 has a trajectory of record length 8
- 31 has a trajectory of record length 10
- 42 has a trajectory of record length 31
- 97 has a trajectory of record length 152
- 1907 has a trajectory of record length 166
- 2130 has a trajectory of record length 217
- 3067 has a trajectory of record length 224
- 5243 has a trajectory of record length 232
- 7355 has a trajectory of record length 302
- 7604 has a trajectory of record length 307
- 10956 has a trajectory of record length >344
![]() |
Figure 2 |
Monday, 9 August 2021
Compositions of 365 and 366
Once the number of days that have elapsed during a calendar year and the number of days that remain are compared, we can look at this as a composition or ordered partition of either 365 during a non-leap year or 366 during a leap year. This composition or ordered partition contains only two elements. Let's consider the compositions of 365 and 366 separately.
Compositions of 365
Because the two elements must add to an odd number, one must be odd and the other even. So there can be no two elements that are both prime. The same applies to lucky numbers that are all odd. Having established that, let's look at some other possibilities.
- Both elements are semiprimes: there are 32 such compositions e.g. (355, 10) or (10, 355) where 10 = 2 x 5 and 355 = 5 x 73. The full list is:
[(355, 10), (339, 26), (327, 38), (326, 39), (319, 46), (314, 51), (303, 62), (291, 74), (278, 87), (274, 91), (259, 106), (254, 111), (247, 118), (219, 146), (206, 159), (187, 178), (178, 187), (159, 206), (146, 219), (118, 247), (111, 254), (106, 259), (91, 274), (87, 278), (74, 291), (62, 303), (51, 314), (46, 319), (39, 326), (38, 327), (26, 339), (10, 355)]
- Both elements are semiprimes with no factors in common: there are 28 such compositions e.g. (339, 26) or (26, 339) where 26 = 2 x 13 and 339 = 3 x 113. The full list is:
[(339, 26), (327, 38), (326, 39), (319, 46), (314, 51), (303, 62), (291, 74), (278, 87), (274, 91), (259, 106), (254, 111), (247, 118), (206, 159), (187, 178), (178, 187), (159, 206), (118, 247), (111, 254), (106, 259), (91, 274), (87, 278), (74, 291), (62, 303), (51, 314), (46, 319), (39, 326), (38, 327), (26, 339)]
- Both elements are semiprimes with one factor in common: there are 4 such compositions e.g. (219, 146) or (146, 219) where 146 = 2 x 73 and 219 = 3 x 73. The full list is:
[(355, 10), (219, 146), (146, 219), (10, 355)]
- Both elements are sphenic numbers, meaning that they have three distinct prime factors: there are 4 such compositions e.g. (255, 110) or (110, 255) where 110 = 2 x 5 x 11 and 255 = 3 x 5 x 17. There are none in the gcd or greatest common divisor is 1. The full list is:
[(255, 110), (195, 170), (170, 195), (110, 255)]
- Both elements are NOT square free: there are 44 such compositions e.g. (361, 4) or (4, 361) where 4 = 2 x 2 and 361 = 19 x 19. The full list is:
[(361, 4), (356, 9), (340, 25), (338, 27), (333, 32), (325, 40), (320, 45), (316, 49), (315, 50), (297, 68), (289, 76), (284, 81), (275, 90), (261, 104), (248, 117), (245, 120), (244, 121), (240, 125), (225, 140), (212, 153), (196, 169), (189, 176), (176, 189), (169, 196), (153, 212), (140, 225), (125, 240), (121, 244), (120, 245), (117, 248), (104, 261), (90, 275), (81, 284), (76, 289), (68, 297), (50, 315), (49, 316), (45, 320), (40, 325), (32, 333), (27, 338), (25, 340), (9, 356), (4, 361)]
Compositions of 366
- Both elements are prime: there are 36 such compositions e.g. (359, 7) and (7, 359). The full list is:
[(359, 7), (353, 13), (349, 17), (347, 19), (337, 29), (313, 53), (307, 59), (293, 73), (283, 83), (277, 89), (269, 97), (263, 103), (257, 109), (239, 127), (229, 137), (227, 139), (199, 167), (193, 173), (173, 193), (167, 199), (139, 227), (137, 229), (127, 239), (109, 257), (103, 263), (97, 269), (89, 277), (83, 283), (73, 293), (59, 307), (53, 313), (29, 337), (19, 347), (17, 349), (13, 353), (7, 359)]
- Both elements are lucky numbers: the lucky numbers in the range between 1 and 366 are:
[1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 49, 51, 63, 67, 69, 73, 75, 79, 87, 93, 99, 105, 111, 115, 127, 129, 133, 135, 141, 151, 159, 163, 169, 171, 189, 193, 195, 201, 205, 211, 219, 223, 231, 235, 237, 241, 259, 261, 267, 273, 283, 285, 289, 297, 303, 307, 319, 321, 327, 331, 339, 349, 357, 361, 363]
There are 20 compositions in which both elements are lucky numbers. These are:
[(363, 3), (357, 9), (303, 63), (297, 69), (273, 93), (267, 99), (261, 105), (237, 129), (231, 135), (195, 171), (171, 195), (135, 231), (129, 237), (105, 261), (99, 267), (93, 273), (69, 297), (63, 303), (9, 357), (3, 363)]
A More General Strategy
Possibly the most useful strategy in this sort of analysis is to list all the numbers between 1 and 366 that have a certain property, such as being lucky (like I just did). A completely general algorithm can then be applied that relies only on the list. Let's consider some happy numbers as an example:
Happy numbers: there are 57 such numbers in the range between 1 and 366. These are:[1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130, 133, 139, 167, 176, 188, 190, 192, 193, 203, 208, 219, 226, 230, 236, 239, 262, 263, 280, 291, 293, 301, 302, 310, 313, 319, 320, 326, 329, 331, 338, 356, 362, 365]
Here is the general algorithm in SageMath:
Figure 1: permalink
Thus we see that there are 6 such pairs in a non-leap year:
The algorithm is easily modified to accommodate leap years and in this case we find that there are 14 such pairs:[(262, 103), (236, 129), (226, 139), (139, 226), (129, 236), (103, 262)]
[(365, 1), (356, 10), (338, 28), (280, 86), (263, 103), (236, 130), (190, 176), (176, 190), (130, 236), (103, 263), (86, 280), (28, 338), (10, 356), (1, 365)]
The list in the algorithm above could be replaced with the list of lucky numbers or any other list and the appropriate pairings could be found. I'll collect these lists together in my online Sage documentation accessible via this link and listed under 365 and 366.
Thursday, 27 May 2021
The p-adics
In a post on January 17th 2019 title The Golden Key, I wrote:
I came across the Golden Key when perusing Kumar Asok Mallik's book The Story of Numbers during his introduction to prime numbers on page 23. This is quite an interesting book that I've added to my Calibre library ... If I can read an entry a day from this book, I'll soon be a wiser man mathematically.
Well it's no surprise that I didn't read an entry a day and in fact I only stumbled upon the post and its reference to Mallik's book when searching for posts related to \(p\)-adic numbers (which he discusses in his book). There is a good article on the \(p\)-adics in Quanta Magazine titled An Infinite Universe of Number Systems. Figure 1 shows a visualisation of 3-adic numbers:
![]() |
Figure 1 |
The diagram makes sense when the following diagrams are considered in Figures 2, 3 and 4. The tube-like structures arise when\(\mod{3^n}\) with \(n=1, 2, 3, ... \) is applied progressively to the natural numbers. The natural numbers become grouped in an entirely new way.
![]() |
| Figure 2 |
![]() |
| Figure 3 |
![]() |
Figure 4 |
Looking at Figure 4, it's clear in this system that 37 is closer to 10 than it is to 36. As the quanta article explains it:
Mallik uses the 7-adic number system for illustration purposes. Here he talks about negative numbers in such a system:The size of a \(p\)-adic number is determined by the prevalence of \(p\) in its prime factorisation. Numbers with more \(p\)s are smaller. For example, in the 3-adics, \(486_{10}=200000_3\) is “small” because it has many 3s in its prime factorisation (486 = 2 x 3 x 3 x 3 x 3 x 3). Another way to think about size is to think about which numbers are close to 0. In the \(p\)-adics, integers are closer together when they share a room at higher levels of the tower. The numbers 0 and 486 share a room up to the fifth level, whereas 0 and 6 share a room on only the first level — indicating that 0 is closer to 486 than to 6 and thus 486 is smaller than 6.
A surprising fact is that for \(p\)-adic integers we do not need any negative sign to indicate negative integers. We determine the negative of a positive integer by determining what needs to be added to this positive integer to yield zero, i.e., by subtracting this number from 0. For example 7-adic expansion of −1 can be written as an integer . . . 6 6 6 6 with infinitely many 6’s on the left. We can verify this result by adding 1 to this 7-adic integer:
Thus we can write that \(-1 = 6 +6 \times 7 + 6 \times 7^2 + 6 \times 7^3 + ... \) which seems odd but if 1 is added to both sides we see that it is in fact true. He goes on to say that:· · · 6 6 6 6 + · · · 0 0 0 1 = · · · 0 0 0 0
Now we show that some \(p\)-adic integers also represent rational fractions like, say, 1/2. The 7-adic integer · · · 3 3 3 4 with infinitely many 3’s represents 1/2, as can easily verified by multiplying this number by 2 or by adding this number to itself:
· · · 3 3 3 4 x 2 = · · · 0 0 0 1
Mallik goes on to mention that \( \sqrt{2} = · · · \text{ 6 2 1 3 } \) because:
![]() |
Figure 5: source |
![]() |
Figure 6: source |
![]() |
Figure 7 |
![]() |
Figure 9: permalink |
To change a decimal fraction into a so-called "basimal" is not difficult. Using 1/2 and base 7 as an example, here is the SageMath code in blue with output in red:
ring=RealField(30)ring(1/2).str(base=7)'0.333333333333'
The 30 just indicates the degree of precision. We see that the 7-ary form of 1/2 is \(0.\overline{3} \). However, this now needs to changed in 7-adic form and to this we need to reverse the order of the digits and place everything to the left of the decimal point. Additionally, 1 must be added to the right-most digit when in the p-adic form:$$0.333333 \dots \rightarrow \dots 333333.0 \rightarrow \dots 333334.0 \rightarrow \overline{3}4.0$$If we multiply this number by 2, the result is 1 and so the representation is correct.
If there is a decimal part in addition to the integer then both parts can be processed together:
n=12.5
n.str(base=7)
'15.333333333333333333'
Changing from 7-ary form to 7-adic form we get: \( \overline{3}4.51 \).
Wednesday, 16 December 2020
Friendly versus Solitary Numbers
Today I turned 26190 days old and discovered that this number forms one half of a friendly pair of numbers. The other half is 8148. What do these two numbers have in common? Well, we find that:$$ \frac{\sigma_1(26190)}{26190}=\frac{70560}{26190}=\frac{784}{291} \text{ and } \frac{\sigma_1(8148)}{8148}=\frac{21952}{8148}=\frac{784}{291}$$So if the sum of the divisors of one number divided by that number is the same as the sum of the divisors of another divided by that other number, then the numbers are said to be friendly. Friendly numbers are not to be confused with amicable numbers where the numbers are related in such a way that the sum of the proper divisors of one is equal to the sum of the proper divisors of the other. The smallest pair of amicable numbers is 220 and 284.
Getting back to friendly numbers, we find that friendly triples and higher-order tuples are also possible. Friendly triples include:
- (2160, 5400, 13104)
- (9360, 21600, 23400)
- (4320, 4680, 26208)
- (6, 28, 496, 8128)
- (3612, 11610, 63984, 70434)
- (3948, 12690, 69936, 76986)
- (84, 270, 1488, 1638, 24384)
- (30, 140, 2480, 6200, 40640)
- (420, 7440, 8190, 18600, 121920)
This ratio of the sum-of-divisors of an integer \(n\) to the integer itself is termed its abundancy and is defined as: \( \displaystyle \frac{\sigma_1(n)}{n}\).
By this definition, two numbers are friendly is they have the same abundancy. Two numbers with the same abundancy form a friendly pair; \(n\) numbers with the same abundancy form a friendly \(n\)-tuple.
Abundancy may also be expressed as \( \sigma _{-1}(n)\) where \( \sigma _{k} \) denotes the sum of the \(k\)-th powers of the divisors of \(n\). When \(k\)=-1, we have the sum of the reciprocals of the divisors. The abundancy of a number \(n\) should not be confused with its abundance \( A(n) \equiv \sigma_1(n)-2n \). Refer to WolframMathWorld.
From Wikipedia we learn that:
if the numbers \(n\) and \( \sigma(n) \) are coprime – meaning that the greatest common divisor of these numbers is 1, so that \( \sigma(n)/n \) is an irreducible fraction – then the number \(n\) is solitary. For a prime number \(p\), we have \( \sigma_1(p) = p + 1\), which is co-prime with \(p\).
Thus all primes and multiples of primes are solitary. Wikipedia continues:
No general method is known for determining whether a number is "friendly" or solitary. The smallest number whose classification is unknown is 10; it is conjectured to be solitary. If it is not, its smallest friend is at least \(10^{30}\). Small numbers with a relatively large smallest friend do exist: for instance, 24 is "friendly", with its smallest friend 91,963,648.
Similarly multiply perfect numbers form friendly families but firstly let's define what is meant by a multiply perfect numbers:
For a given natural number \(k\), a number \(n\) is called \(k\)-perfect (or \(k\)-fold perfect) if and only if the sum of all positive divisors of \(n\) (the divisor function, \( \sigma(n) \), is equal to \(k \times n\); a number is thus perfect if and only if it is 2-perfect. A number that is \(k\)-perfect for a certain \(k\) is called a multiply perfect number. As of 2014, \(k\)-perfect numbers are known for each value of \(k\) up to 11. Source. Also see my blog post Multiperfect, Hyperfect and Superperfect Numbers from July 24th 2019.
The club of friendly numbers with abundancy equal to 9 has 2094 known members but these multiply perfect clubs or families are thought to be finite (unlike the perfect family that is conjectured to be infinite).
There are a number of OEIS sequences associated with friendly and solitary numbers. It was stated earlier that numbers that are coprime with their sum of divisors are solitary but this is sufficient and not necessary condition for solitariness. OEIS A095739 lists those numbers that are solitary and yet not coprime with their sum of divisors:
A095739 | Numbers known to be solitary but not coprime to sigma. |
A050973 | Larger member of friendly pairs ordered by smallest maximal element. |
28, 140, 200, 224, 234, 270, 308, 364, 476, 496, 496, 532, 600, 644, 672, 700, 812, 819, 868, 936, 1036, 1148, 1170, 1204, 1316, 1400, 1484, 1488, 1488, 1540, 1638, 1638, 1638, 1652, 1708, 1800, 1820, 1876, 1988, 2016, 2044, 2200, 2212, 2324, ...
The smaller members of these pairs are given by OEIS A050972:
A050972 | Smaller member of friendly pairs ordered by smallest maximal element. |
6, 30, 80, 40, 12, 84, 66, 78, 102, 6, 28, 114, 240, 138, 120, 150, 174, 135, 186, 864, 222, 246, 60, 258, 282, 560, 318, 84, 270, 330, 84, 270, 1488, 354, 366, 720, 390, 402, 426, 360, 438, 880, 474, 498, 510, 440, 30, 140, 534, 132, 1040, 570, 582, 606, ...
From these sequences, we can form the various pairs e.g. 28 and 6, 140 and 30 etc. Notice the two numbers (819 and 135) marked in bold in the above sequences. This pair are an example of two odd numbers being friendly. There are also cases of even being friendly to odd, such as 42 and 544635 with abundancy 16/7.



























