Friday 24 February 2023

26990: Reverse and Add

I first posted on the topic of Reverse and Add on the 7th January 2016, less than six months after I started this blog. The post was titled 22, Reverse and Add, and later that year (22nd June 2016)  I made a post titled Remembering Reverse and Add, Palindromes and Trajectories. The post titled Lychrel Numbers on 14th September 2016 is also relevant. Since 2016 I've touched on the topic in several other posts.

Today I turned 26990 days old and one of the properties of this number is that it's a member of OEIS A065318:


 A065318

24 'Reverse and Add' steps are needed to reach a palindrome.



Such a large number of steps is uncommon as can be seen from the membership:

89, 98, 16991, 17981, 18971, 19961, 26990, 27980, 28970, 29960, 50169, 51159, 52149, 53139, 54129, 55119, 56109, 56199, 57189, 58179, 59169, 60168, 60649, 61158, 61639, 62148, 62629, 63138, 63619, 64128, 64609, 64699, 65118, 65689, 66108, 66198, 66679, 67188, 67669, 68178, 68659, 69168, 69649, 70167, 70648, 71157, 71638, 72147, 72628, 73618, 74127, 74608, 74698, 75117, 75688, 76107, 76197, 76678, 77187, 77668, 78177, 78658, 79167, 79648, 80166, 80339, 80499

To get an overview of what's going on, I plotted the length of the trajectories of all numbers from 1 to 40000. The result is shown in Figure 1 where the initial members of the sequence (89, 98, 16991, 17981, 18971, 19961, 26990, 27980, 28970, 29960) are clearly visible along the red line.


Figure 1: permalink

The calculation timed out in SageMathCell and so the plot was created using my Jupyter notebook which has proven invaluable for computationally intense tasks. Sometimes the kernel will crash and the tasks cannot be completed but this is not all that common. The plot also shows how rare trajectory lengths of 24 and above are. Figure 2 shows a similar plot both this time in the range up to 100,000. As can be seen, the numbers that have trajectory lengths of 24, while initially scarce, become more frequent between 50,000 and 100,000. Some other trajectory red lines have also been marked in addition to that of 24.


Figure 2

Figure 3 shows the trajectories for numbers up to one million. Notice how the trajectory 24 numbers are fairly numerous between 50,000 and 500,000 but after that there is a gap followed by three equally spaced groups and then no numbers after about 800,000. Again, this plot was only achieved using a Jupyter notebook and letting my old 2013 laptop crunch away at the calculation.


Figure 3

As the range gets larger, new trajectory lengths begin to appear. For example, a group of numbers in equally spaced clumps appear with trajectory length 64 between about 180,000 and 820,000.

Thursday 23 February 2023

Concatenating Prime Factors

I noticed that the number associated with my diurnal age today, 26989, is a semiprime that factors to 137 x 197. Concatenating these two factors, we get 137197 which is prime but if we concatenate 197 x 137 we get 197137 which is also prime. Semiprimes with this property constitute OEIS A330441:


 A330441

Semiprimes \(p \times q\) such that the concatenations of \(p\) and \(q\) in both orders are prime.



The initial members of this sequence are:

21, 33, 51, 93, 111, 133, 177, 201, 219, 247, 253, 327, 411, 427, 573, 589, 679, 687, 763, 793, 813, 889, 993, 1077, 1081, 1119, 1243, 1339, 1347, 1401, 1411, 1497, 1501, 1603, 1623, 1651, 1671, 1821, 1839, 1843, 1851, 1981, 2019, 2047, 2059, 2103, 2157, 2199, 2217, 2469, 2479, 2629, 2761, 2787

Given that 26989 is an emirpimes (since its reverse is a distinct semiprime: 98962 = 2 x 49481), I thought I'd investigate how many emirpimes are in this sequence. It turns out that in the range up to one million there are the following:

3099, 9903, 10519, 11707, 13993, 16387, 18247, 19039, 30607, 32667, 36367, 38697, 39487, 39931, 70603, 70711, 72247, 73099, 74227, 74281, 74289, 76029, 76363, 76623, 78361, 78493, 78619, 79683, 91501, 91687, 92067, 93091, 98247, 99037, 100437, 101317, 101899, 104529, 108181, 108789, 120553, 126771, 133243, 134797, 137671, 144523, 147061, 149449, 159427, 160741, 168117, 176731, 176767, 177621, 181801, 184033, 197097, 199879, 312817, 322489, 325441, 328459, 330397, 330481, 331783, 337297, 337897, 338977, 342331, 345493, 350569, 355021, 357393, 365863, 368563, 386197, 387133, 393753, 394543, 711861, 713101, 716779, 717469, 718213, 724951, 734001, 767671, 779833, 790791, 791683, 792733, 793033, 797431, 798733, 925401, 944941, 951679, 954823, 964699, 964717, 965053, 976159, 977617, 978991, 984223, 987801, 996469, 998101

Let's check one of the entries, say the last. 998101 should have its reversal present in the list, 101899, which it does and both should have factors that can be concatenated in either way to produce primes:

998101 = 13 x 76777 with 1376777 and 7677713 both prime
101899 =  7 x 14557 with 714557 and 145577 both prime

This got me thinking about sphenic numbers, that is numbers of the form \(p \times q \times r\) where \(p\), \(q\) and \(r\) are distinct prime factors, with the property that any concatenation of these prime factors produces a prime. In other words:
  • p | q | r is prime
  • p | r | q is prime
  • q | p | r is prime
  • q | r | p is prime
  • r | p | q is prime
  • r | q | p is prime
In the range up to one million, there are 15 such numbers (permalink). They are:

3311, 27181, 32153, 41237, 53977, 86507, 110971, 125069, 208579, 256413, 500981, 543337, 853811, 901949, 964481

Here is the breakdown for each number:

3311 = 7 x 11 x 43 --> 71143 74311 11743 11437 43117 43711
27181 = 7 x 11 x 353 --> 711353 735311 117353 113537 353117 353711
32153 = 11 x 37 x 79 --> 113779 117937 371179 377911 793711 791137
41237 = 7 x 43 x 137 --> 743137 713743 437137 431377 137437 137743
53977 = 7 x 11 x 701 --> 711701 770111 117701 117017 701117 701711
86507 = 19 x 29 x 157 --> 1929157 1915729 2919157 2915719 1572919 1571929
110971 = 7 x 83 x 191 --> 783191 719183 837191 831917 191837 191783
125069 = 7 x 17 x 1051 --> 7171051 7105117 1771051 1710517 1051177 1051717
208579 = 7 x 83 x 359 --> 783359 735983 837359 833597 359837 359783
256413 = 3 x 127 x 673 --> 3127673 3673127 1273673 1276733 6731273 6733127
500981 = 13 x 89 x 433 --> 1389433 1343389 8913433 8943313 4338913 4331389
543337 = 17 x 31 x 1031 --> 17311031 17103131 31171031 31103117 10313117 10311731
853811 = 7 x 283 x 431 --> 7283431 7431283 2837431 2834317 4312837 4317283
901949 = 19 x 37 x 1283 --> 19371283 19128337 37191283 37128319 12833719 12831937
964481 = 7 x 211 x 653 --> 7211653 7653211 2117653 2116537 6532117 6537211

Note how 9 of the 15 numbers have 7 as a factor. Even though the reversals of some of the above numbers are also sphenic numbers (35123, 179011, 975802, 189005, 949109), none of them have the concatenating prime factors property. The first member of any sequence is special and so the takeaway here might be the following:
3099 is the smallest of a very special class of semiprimes because its distinct prime factors can be concatenated in either order to make primes and its reversal, 9903, is also a semiprime with the same property.

3311 is the smallest of a very special class of sphenic numbers because its prime factors can be concatenated in all six ways to make primes. 

While this topic falls squarely into the category of recreational mathematics, it's nonetheless fun to investigate and it helps to challenge my limited SageMath programming capabilities.

Wednesday 22 February 2023

Modest Numbers (Continued)

CONTINUED FROM PREVIOUS POST

I'm having to run the previous blog post into this new post because I found that the word wrap wasn't working despite numerous efforts to fix it. 

In this continuation, I want to mention the fact that some numbers are "modest" in two ways not just one. Here is a list of such numbers in the range up to 40,000:

1333, 1999, 2333, 2666, 2999, 3999, 4666, 4999, 5999, 6999, 7999, 8999, 11111, 13333, 19999, 21111, 22222, 23333, 26666, 29999, 31111, 33333, 39999

As can be seen, all numbers have many repeated digits. Let's look at the first number in the list, 1333. We see that:$$ 1333 \! \!\! \mod 33 \equiv 13\\1333 \! \! \! \mod 333 \equiv 1$$Once we extend the range to one million, we find some numbers that are "modest" in three ways. These are:

133333, 199999, 233333, 266666, 299999, 399999, 466666, 499999, 599999, 699999, 799999, 899999

Taking the first number in the list above, 133333, we find that:$$ 133333 \! \!\! \mod 333 \equiv 133\\133333 \! \! \! \mod 3333 \equiv 13\\133333 \! \! \! \mod 33333 \equiv 1$$Clearly there is a pattern here and if we were to extend the range even further we would find that there are numbers that are modest in four ways and more. For example, 13333333 is "modest" is four ways:$$ 13333333 \! \!\! \mod 3333 \equiv 1333\\13333333 \! \! \! \mod 33333 \equiv 133\\13333333 \! \! \! \mod 333333 \equiv 13\\13333333 \! \! \! \mod 3333333 \equiv 1$$Once the algorithm for splitting any two digit number or larger into two parts is in place, it can be applied to other scenarios other than modest numbers. For example, consider this scenario where we define a "digestible" number for want of a better term as follows:

A number \(n\) is called digestible if its digits can be separated into two numbers \(a\) and \(b\) such that \( n\) divides evenly into \(a^b\).

In the range up to 40,000, there are 41 numbers that satisfy this criterion. They are (permalink):

128, 256, 486, 648, 729, 1024, 1296, 2048, 2187, 3072, 4096, 6075, 6144, 6561, 6912, 8192, 10240, 12288, 13824, 14336, 15488, 15625, 16384, 16807, 17496, 18432, 20480, 21609, 22528, 24576, 26624, 27648, 28672, 30375, 30720, 32768, 33614, 34816, 35721, 36864, 38912

The details for each number are as follows:


Figure 1

Let's take the first number in this list, 128, that divides evenly into 12 raised to the 8th power. Now 12 raised to the 8th power is 429981696 and 128 | 429981696 = 3359232. This is just an example of the sorts of investigations that can be carried out. Notice how all the powers of 2 are represented.

Modest Numbers

Modest numbers are a category of numbers that I haven't paid a great deal of attention to. They are defined by Numbers Aplenty in the following manner:

A number \(n\) is called modest if its digits can be separated into two numbers \(a\) and \(b\) such that \(n\) divided by \(b\) gives \(a\) as remainder.

The reason its came to my attention is that Julian Day Number 2459999 is approaching and it has the property of being a modest number because 9999 divides 2459999 to give 245 or to put it in another format:$$2459999 \! \! \mod 99999 \equiv 245$$I developed an algorithm in SageMath to determine all the modest numbers in a given range. Here are the modest numbers in the range up to 40,000 (permalink), constituting 2.25% of the range:

13, 19, 23, 26, 29, 39, 46, 49, 59, 69, 79, 89, 103, 109, 111, 133, 199, 203, 206, 209, 211, 218, 222, 233, 266, 299, 309, 311, 327, 333, 399, 406, 409, 411, 412, 418, 422, 433, 436, 444, 466, 499, 509, 511, 515, 533, 545, 555, 599, 609, 611, 618, 622, 627, 633, 654, 666, 699, 709, 711, 721, 733, 763, 777, 799, 809, 811, 812, 818, 822, 824, 833, 836, 844, 866, 872, 888, 899, 911, 927, 933, 981, 999, 1003, 1009, 1011, 1015, 1018, 1022, 1027, 1030, 1033, 1037, 1045, 1055, 1066, 1090, 1099, 1111, 1133, 1199, 1218, 1222, 1227, 1233, 1236, 1244, 1254, 1266, 1299, 1333, 1339, 1399, 1418, 1421, 1422, 1433, 1442, 1463, 1466, 1477, 1499, 1527, 1533, 1545, 1555, 1599, 1618, 1622, 1624, 1633, 1636, 1644, 1648, 1666, 1672, 1688, 1699, 1733, 1751, 1799, 1822, 1827, 1833, 1854, 1866, 1881, 1899, 1933, 1957, 1999, 2003, 2006, 2009, 2018, 2022, 2027, 2030, 2033, 2036, 2037, 2044, 2045, 2054, 2055, 2060, 2066, 2074, 2090, 2099, 2111, 2127, 2133, 2163, 2177, 2199, 2222, 2233, 2266, 2299, 2333, 2369, 2399, 2427, 2433, 2436, 2444, 2454, 2466, 2472, 2488, 2499, 2533, 2545, 2555, 2575, 2599, 2633, 2639, 2666, 2678, 2699, 2733, 2781, 2799, 2833, 2836, 2842, 2844, 2863, 2866, 2877, 2884, 2899, 2933, 2987, 2999, 3009, 3027, 3033, 3037, 3045, 3054, 3055, 3066, 3081, 3090, 3099, 3111, 3133, 3193, 3199, 3233, 3236, 3244, 3248, 3266, 3272, 3288, 3296, 3299, 3333, 3399, 3451, 3466, 3499, 3545, 3555, 3563, 3577, 3599, 3644, 3654, 3666, 3681, 3699, 3799, 3857, 3866, 3899, 3999, 4006, 4009, 4012, 4018, 4027, 4036, 4037, 4044, 4045, 4054, 4055, 4060, 4066, 4072, 4074, 4088, 4090, 4099, 4108, 4111, 4148, 4199, 4222, 4254, 4263, 4266, 4277, 4299, 4333, 4399, 4444, 4466, 4499, 4555, 4581, 4599, 4666, 4669, 4699, 4799, 4854, 4866, 4872, 4888, 4899, 4963, 4977, 4999, 5009, 5015, 5027, 5037, 5045, 5055, 5066, 5075, 5090, 5099, 5111, 5135, 5185, 5199, 5266, 5278, 5299, 5333, 5399, 5466, 5481, 5499, 5555, 5599, 5663, 5666, 5672, 5677, 5684, 5688, 5699, 5799, 5866, 5887, 5899, 5999, 6009, 6018, 6027, 6037, 6054, 6066, 6074, 6081, 6090, 6099, 6111, 6162, 6199, 6222, 6266, 6293, 6299, 6333, 6377, 6381, 6399, 6466, 6472, 6488, 6496, 6499, 6599, 6666, 6699, 6799, 6899, 6999, 7009, 7021, 7027, 7037, 7063, 7077, 7090, 7099, 7111, 7189, 7199, 7259, 7281, 7288, 7299, 7333, 7399, 7499, 7599, 7699, 7777, 7799, 7899, 7999, 8009, 8012, 8018, 8024, 8027, 8036, 8037, 8054, 8072, 8074, 8088, 8090, 8099, 8108, 8111, 8148, 8199, 8216, 8222, 8296, 8299, 8333, 8399, 8444, 8499, 8599, 8666, 8699, 8799, 8888, 8899, 8999, 9027, 9037, 9081, 9099, 9111, 9199, 9243, 9299, 9333, 9399, 9499, 9599, 9699, 9799, 9899, 9999, 10003, 10009, 10011, 10015, 10018, 10027, 10030, 10033, 10037, 10045, 10054, 10074, 10090, 10099, 10101, 10111, 10135, 10185, 10222, 10270, 10303, 10333, 10370, 10555, 10666, 10909, 10999, 11027, 11033, 11037, 11099, 11111, 11297, 11333, 11407, 11999, 12018, 12027, 12036, 12037, 12054, 12074, 12081, 12108, 12111, 12148, 12162, 12222, 12324, 12333, 12444, 12666, 12999, 13027, 13037, 13039, 13111, 13117, 13333, 13351, 13481, 13999, 14018, 14021, 14027, 14037, 14042, 14054, 14063, 14074, 14111, 14126, 14189, 14222, 14259, 14333, 14378, 14518, 14666, 14777, 14999, 15027, 15037, 15045, 15081, 15111, 15135, 15185, 15333, 15405, 15555, 15999, 16018, 16024, 16027, 16036, 16037, 16048, 16054, 16072, 16074, 16108, 16111, 16144, 16148, 16216, 16222, 16296, 16333, 16432, 16444, 16592, 16666, 16888, 16999, 17027, 17037, 17051, 17111, 17153, 17333, 17459, 17629, 17999, 18027, 18037, 18054, 18074, 18081, 18111, 18162, 18222, 18243, 18333, 18486, 18666, 18999, 19027, 19037, 19057, 19111, 19171, 19333, 19513, 19703, 19999, 20003, 20006, 20009, 20011, 20018, 20022, 20027, 20030, 20033, 20036, 20037, 20045, 20054, 20060, 20066, 20074, 20090, 20099, 20101, 20108, 20111, 20135, 20148, 20180, 20185, 20198, 20202, 20222, 20270, 20303, 20333, 20370, 20444, 20540, 20555, 20606, 20666, 20740, 20909, 20999, 21027, 21037, 21063, 21081, 21111, 21189, 21259, 21333, 21567, 21777, 21818, 21999, 22027, 22033, 22037, 22054, 22066, 22074, 22099, 22111, 22198, 22222, 22297, 22333, 22407, 22594, 22666, 22814, 22999, 23027, 23037, 23069, 23111, 23207, 23333, 23621, 23851, 23999, 24027, 24036, 24037, 24054, 24072, 24074, 24081, 24108, 24111, 24148, 24162, 24216, 24222, 24296, 24324, 24333, 24444, 24648, 24666, 24888, 24999, 25027, 25037, 25045, 25075, 25111, 25135, 25185, 25225, 25333, 25555, 25675, 25925, 25999, 26027, 26037, 26039, 26054, 26074, 26078, 26111, 26117, 26222, 26234, 26333, 26351, 26481, 26666, 26702, 26962, 26999, 27037, 27081, 27111, 27243, 27333, 27729, 27999, 28036, 28037, 28042, 28054, 28063, 28074, 28084, 28108, 28111, 28126, 28148, 28189, 28222, 28252, 28259, 28333, 28378, 28444, 28518, 28666, 28756, 28777, 28999, 29037, 29087, 29111, 29261, 29333, 29783, 29999, 30009, 30011, 30027, 30033, 30037, 30045, 30054, 30074, 30081, 30090, 30099, 30101, 30111, 30135, 30162, 30185, 30222, 30270, 30297, 30303, 30333, 30370, 30405, 30555, 30666, 30810, 30909, 30999, 31037, 31093, 31111, 31279, 31333, 31837, 31999, 32036, 32037, 32048, 32054, 32072, 32074, 32096, 32108, 32111, 32144, 32148, 32216, 32222, 32288, 32296, 32333, 32432, 32444, 32592, 32666, 32727, 32864, 32888, 32999, 33037, 33081, 33099, 33111, 33297, 33333, 33407, 33891, 33999, 34037, 34051, 34054, 34074, 34102, 34111, 34153, 34222, 34306, 34333, 34459, 34629, 34666, 34918, 34999, 35037, 35045, 35063, 35105, 35111, 35135, 35185, 35189, 35259, 35315, 35333, 35555, 35777, 35945, 35999, 36037, 36054, 36074, 36081, 36108, 36111, 36148, 36162, 36222, 36243, 36324, 36333, 36444, 36486, 36666, 36972, 36999, 37111, 37333, 37999, 38054, 38057, 38074, 38111, 38114, 38171, 38222, 38333, 38342, 38513, 38666, 38703, 38999, 39081, 39111, 39117, 39333, 39351, 39481, 39999

Even though the first three modest numbers are prime, the prime modest numbers occupy only 0.27% of the range (108 numbers). Consecutive modest numbers are few and far between. Here are the pairs of such numbers up to 40,000:

411 and 412
811 and 812
1421 and 1422
2036 and 2037
2044 and 2045
2054 and 2055
3054 and 3055
4036 and 4037
4044 and 4045
4054 and 4055
8036 and 8037
12036 and 12037
16036 and 16037
20036 and 20037
24036 and 24037
28036 and 28037
32036 and 32037

No triplets have been found as far as I know.

It's of interest to consider the frequency of final digits of modest numbers.

Here is the breakdown of final digits in the range up to 100000 (permalink):

There are a total of 1728 modest numbers:

0 --> 67
1 --> 218
2 --> 151
3 --> 219
4 --> 161
5 --> 128
6 --> 172
7 --> 159
8 --> 144
9 --> 309

Clearly numbers ending in the digit 9 predominate.

CONTINUED IN NEXT POST DUE TO TECHNICAL DIFFICULTIES

Sunday 19 February 2023

Midway Between Cubics and Pronics

Recently I posted about distances to cubic numbers (In the Vicinity of Cubic Numbers) as well as the product of three consecutive integers (Infinite Sums of Reciprocals of Pronic Numbers). These latter numbers are referred to variously as pronic, promic and oblong numbers. The number associated with my diurnal age today, 26985, involves both cubic and pronic numbers and qualifies it for inclusion in OEIS A342873:


 A342873

Numbers whose distance to the nearest cube equals the distance to the nearest product of 3 consecutive integers (three-dimensional oblong).



My approach to generating the terms of this sequence, using SageMath, was to first generate, separately, the sequence of cubic numbers and the sequence of oblong numbers up to a little over 42,000. 

The sequence of 36 cubic numbers (including zero) is:

0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, 1331, 1728, 2197, 2744, 3375, 4096, 4913, 5832, 6859, 8000, 9261, 10648, 12167, 13824, 15625, 17576, 19683, 21952, 24389, 27000, 29791, 32768, 35937, 39304, 42875

The sequence of 36 oblong numbers (including zero) is:

0, 6, 24, 60, 120, 210, 336, 504, 720, 990, 1320, 1716, 2184, 2730, 3360, 4080, 4896, 5814, 6840, 7980, 9240, 10626, 12144, 13800, 15600, 17550, 19656, 21924, 24360, 26970, 29760, 32736, 35904, 39270, 42840, 46620

Combined these two sets of numbers together gives a total of 71 numbers since zero is duplicated:

0, 1, 6, 8, 24, 27, 60, 64, 120, 125, 210, 216, 336, 343, 504, 512, 720, 729, 990, 1000, 1320, 1331, 1716, 1728, 2184, 2197, 2730, 2744, 3360, 3375, 4080, 4096, 4896, 4913, 5814, 5832, 6840, 6859, 7980, 8000, 9240, 9261, 10626, 10648, 12144, 12167, 13800, 13824, 15600, 15625, 17550, 17576, 19656, 19683, 21924, 21952, 24360, 24389, 26970, 27000, 29760, 29791, 32736, 32768, 35904, 35937, 39270, 39304, 42840, 42875, 46620

Fortunately the order of these numbers, after zero, alternates from cubic to oblong and this algorithm was able to be applied in order to identify the numbers that satisfied the criterion imposed by OEIS A342873. These are the resulting numbers up to a little over 40,000:

0, 7, 16, 62, 92, 213, 276, 508, 616, 995, 1160, 1722, 1956, 2737, 3052, 4088, 4496, 5823, 6336, 7990, 8620, 10637, 11396, 13812, 14712, 17563, 18616, 21938, 23156, 26985, 28380, 32752, 34336, 39287, 41072

For example, today's number of 26985 is a distance of 15 from the nearest cubic number (27000 = 30 x 30 x 30) and the same distance from the nearest oblong numbers (26970 = 29 x 30 x 31). 

Had the two sets of numbers become jumbled up when combined, the task of identifying suitable numbers would have been more difficult. However, the oblong numbers \(n \times (n+1) \times (n+2) \) are only a little ahead of corresponding cubic numbers (\(n^3 )\) and so the problem doesn't arise.

To see that the oblong number following the cube is always less than the next cube, consider the following:$$ \begin{align} n  (n+1) (n+2) &=n^3 + 3n^2 + 2n\\(n+1)^3&=n^3+3n^2+3n+1 \end{align}$$Clearly the next cubic number is always \(n+1\) ahead of the oblong number. The same reasoning would apply if we looked at numbers that are equidistant from the nearest square number and the nearest pronic number.

The earlier algorithm is easily modified to produce these numbers that constitute OEIS A074378:


 A074378

Numbers whose distance to nearest square number equals their distance to nearest pronic number.



The modified algorithm generates these numbers:

0, 3, 5, 14, 18, 33, 39, 60, 68, 95, 105, 138, 150, 189, 203, 248, 264, 315, 333, 390, 410, 473, 495, 564, 588, 663, 689, 770, 798, 885, 915, 1008, 1040, 1139, 1173, 1278, 1314, 1425, 1463, 1580, 1620, 1743, 1785, 1914, 1958, 2093, 2139, 2280, 2328, 2475, 2525, 2678, 2730, 2889, 2943, 3108, 3164, 3335, 3393, 3570, 3630, 3813, 3875, 4064, 4128, 4323, 4389, 4590, 4658, 4865, 4935, 5148, 5220, 5439, 5513, 5738, 5814, 6045, 6123, 6360, 6440, 6683, 6765, 7014, 7098, 7353, 7439, 7700, 7788, 8055, 8145, 8418, 8510, 8789, 8883, 9168, 9264, 9555, 9653, 9950, 10050, 10353, 10455, 10764, 10868, 11183, 11289, 11610, 11718, 12045, 12155, 12488, 12600, 12939, 13053, 13398, 13514, 13865, 13983, 14340, 14460, 14823, 14945, 15314, 15438, 15813, 15939, 16320, 16448, 16835, 16965, 17358, 17490, 17889, 18023, 18428, 18564, 18975, 19113, 19530, 19670, 20093, 20235, 20664, 20808, 21243, 21389, 21830, 21978, 22425, 22575, 23028, 23180, 23639, 23793, 24258, 24414, 24885, 25043, 25520, 25680, 26163, 26325, 26814, 26978, 27473, 27639, 28140, 28308, 28815, 28985, 29498, 29670, 30189, 30363, 30888, 31064, 31595, 31773, 32310, 32490, 33033, 33215, 33764, 33948, 34503, 34689, 35250, 35438, 36005, 36195, 36768, 36960, 37539, 37733, 38318, 38514, 39105, 39303, 39900, 40100

For example, the number 14 in this sequence is an equal distance from 12 = 3 x 4 and 16 = 4 x 4. The algorithm could be extended (permalink) the other way to find numbers that are equidistant from the nearest fourth power and the number that is a product of four consecutive integers. The initial resultant numbers are not a part of any OEIS sequence but they are as follows:

0, 20, 188, 308, 1068, 1488, 3560, 4568, 8960, 10940, 18948, 22380, 35588, 41048, 61328, 69488, 99000, 110628, 151820, 167780

For example the number 20 is equidistant from 16 = 2 x 2 x 2 x 2 and 24 = 1 x 2 x 3 x 4. The algorithm could be extended indefinitely but to little purpose. Nonetheless, it's been an interesting exercise.

Thursday 16 February 2023

The Julian Day Number

In a January 2023 post titled Turning Dates into Numbers, I described one way of turning a unique date into a unique number using the YYYYMMDD method. However, another way is to simply affix the day of the year to the year using a YYYYDDD template (where D stands for Digit rather than Day). In non-leap years, the DDD will range from 001 to 365 and in leap years it will range from 0 to 366. Today being the 16th February 2023, the number would be 2023047.

This system has the advantage of producing six digit numbers rather the eight digit numbers that arise from the YYYYMMDD system. Another advantage is that there are no gaps in the progression of numbers. The transition from one month to the next in the YYYYMMDD system produces gaps. For example, the end of January this year corresponded to the number 20230131 and this was followed immediately by 20230201, corresponding to the 1st February. There is a gap of 70 between these two numbers.

What about the transition from one year to the next. On 31st December 2023, the number 2023365 transitions to 2024001. This a number gap of 636 and a serious discontinuity. This led me to consider methods for arriving at a continuous count and I was reminded of the Julian Day that appears in the horoscopes generated by Astrolog. See Figure 1 that shows the chart for the current time in Jakarta with a Julian Day of 2459991.62287.


Figure 1

So what is a Julian Day Number? Here is what Wikipedia has to say on the topic:

The Julian day is the continuous count of days since the beginning of the Julian period, and is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g. food production date and sell by date).

The Julian period is a chronological interval of 7980 years; year 1 of the Julian Period was 4713 BC (−4712). The Julian calendar year 2023 is year 6736 of the current Julian Period. The next Julian Period begins in the year AD 3268. Historians used the period to identify Julian calendar years within which an event occurred when no such year was given in the historical record, or when the year given by previous historians was incorrect.

The Julian day number (JDN) is the integer assigned to a whole solar day in the Julian day count starting from noon Universal Time, with Julian day number 0 assigned to the day starting at noon on Monday, January 1, 4713 BC, proleptic Julian calendar (November 24, 4714 BC, in the proleptic Gregorian calendar), a date at which three multi-year cycles started (which are: Indiction, Solar, and Lunar cycles) and which preceded any dates in recorded history. For example, the Julian day number for the day starting at 12:00 UT (noon) on January 1, 2000, was 2451545.

The Julian date (JD) of any instant is the Julian day number plus the fraction of a day since the preceding noon in Universal Time. Julian dates are expressed as a Julian day number with a decimal fraction added. For example, the Julian Date for 00:30:00.0 UT January 1, 2013, is 2456293.520 833. This page was loaded at 2023-02-15 23:56:54 (UTC) – expressed as a Julian date this is 2459991.4978472. 

I was clueless as to what was meant by indiction but it is explained as follows, again quoting from Wikipedia:

An indiction (Latin: indictio, impost) was a periodic reassessment of taxation in the Roman Empire which took place every fifteen years. In Late Antiquity, this 15-year cycle began to be used to date documents and it continued to be used for this purpose in Medieval Europe, and can also refer to an individual year in the cycle; for example, "the fourth indiction" came to mean the fourth year of the current indiction. Since the cycles themselves were not numbered, other information is needed to identify the specific year.

The key numbers are 15, 19 and 28 that multiply together to give 7980. The article continues:

The Julian day number is based on the Julian Period proposed by Joseph Scaliger, a classical scholar, in 1583 (one year after the Gregorian calendar reform) as it is the product of three calendar cycles used with the Julian calendar:

28 (solar cycle) × 19 (lunar cycle) × 15 (indiction cycle) = 7980 years

Its epoch occurs when all three cycles (if they are continued backward far enough) were in their first year together. Years of the Julian Period are counted from this year, 4713 BC, as year 1, which was chosen to be before any historical record.

TODAY IS JULIAN DAY NUMBER 2459991

A formula is provided to convert any Gregorian calendar date to its equivalent Julian day number. It is stated below and here is a permalink to its calculation for any given day.

JDN = (1461 × (Y + 4800 + (M − 14)/12))/4 +(367 × (M − 2 − 12 × ((M − 14)/12)))/12 − (3 × ((Y + 4900 + (M - 14)/12)/100))/4 + D − 32075 

This number has much to recommend it. Currently the Julian day number is seven digits long and will remain so for many years to come. So for 2023, the 1st January corresponds to a JDN of 2459946 and the 31st December 2023 corresponds to 2460310. The full range of numbers for 2023 is:

2459946, 2459947, 2459948, 2459949, 2459950, 2459951, 2459952, 2459953, 2459954, 2459955, 2459956, 2459957, 2459958, 2459959, 2459960, 2459961, 2459962, 2459963, 2459964, 2459965, 2459966, 2459967, 2459968, 2459969, 2459970, 2459971, 2459972, 2459973, 2459974, 2459975, 2459976, 2459977, 2459978, 2459979, 2459980, 2459981, 2459982, 2459983, 2459984, 2459985, 2459986, 2459987, 2459988, 2459989, 2459990, 2459991, 2459992, 2459993, 2459994, 2459995, 2459996, 2459997, 2459998, 2459999, 2460000, 2460001, 2460002, 2460003, 2460004, 2460005, 2460006, 2460007, 2460008, 2460009, 2460010, 2460011, 2460012, 2460013, 2460014, 2460015, 2460016, 2460017, 2460018, 2460019, 2460020, 2460021, 2460022, 2460023, 2460024, 2460025, 2460026, 2460027, 2460028, 2460029, 2460030, 2460031, 2460032, 2460033, 2460034, 2460035, 2460036, 2460037, 2460038, 2460039, 2460040, 2460041, 2460042, 2460043, 2460044, 2460045, 2460046, 2460047, 2460048, 2460049, 2460050, 2460051, 2460052, 2460053, 2460054, 2460055, 2460056, 2460057, 2460058, 2460059, 2460060, 2460061, 2460062, 2460063, 2460064, 2460065, 2460066, 2460067, 2460068, 2460069, 2460070, 2460071, 2460072, 2460073, 2460074, 2460075, 2460076, 2460077, 2460078, 2460079, 2460080, 2460081, 2460082, 2460083, 2460084, 2460085, 2460086, 2460087, 2460088, 2460089, 2460090, 2460091, 2460092, 2460093, 2460094, 2460095, 2460096, 2460097, 2460098, 2460099, 2460100, 2460101, 2460102, 2460103, 2460104, 2460105, 2460106, 2460107, 2460108, 2460109, 2460110, 2460111, 2460112, 2460113, 2460114, 2460115, 2460116, 2460117, 2460118, 2460119, 2460120, 2460121, 2460122, 2460123, 2460124, 2460125, 2460126, 2460127, 2460128, 2460129, 2460130, 2460131, 2460132, 2460133, 2460134, 2460135, 2460136, 2460137, 2460138, 2460139, 2460140, 2460141, 2460142, 2460143, 2460144, 2460145, 2460146, 2460147, 2460148, 2460149, 2460150, 2460151, 2460152, 2460153, 2460154, 2460155, 2460156, 2460157, 2460158, 2460159, 2460160, 2460161, 2460162, 2460163, 2460164, 2460165, 2460166, 2460167, 2460168, 2460169, 2460170, 2460171, 2460172, 2460173, 2460174, 2460175, 2460176, 2460177, 2460178, 2460179, 2460180, 2460181, 2460182, 2460183, 2460184, 2460185, 2460186, 2460187, 2460188, 2460189, 2460190, 2460191, 2460192, 2460193, 2460194, 2460195, 2460196, 2460197, 2460198, 2460199, 2460200, 2460201, 2460202, 2460203, 2460204, 2460205, 2460206, 2460207, 2460208, 2460209, 2460210, 2460211, 2460212, 2460213, 2460214, 2460215, 2460216, 2460217, 2460218, 2460219, 2460220, 2460221, 2460222, 2460223, 2460224, 2460225, 2460226, 2460227, 2460228, 2460229, 2460230, 2460231, 2460232, 2460233, 2460234, 2460235, 2460236, 2460237, 2460238, 2460239, 2460240, 2460241, 2460242, 2460243, 2460244, 2460245, 2460246, 2460247, 2460248, 2460249, 2460250, 2460251, 2460252, 2460253, 2460254, 2460255, 2460256, 2460257, 2460258, 2460259, 2460260, 2460261, 2460262, 2460263, 2460264, 2460265, 2460266, 2460267, 2460268, 2460269, 2460270, 2460271, 2460272, 2460273, 2460274, 2460275, 2460276, 2460277, 2460278, 2460279, 2460280, 2460281, 2460282, 2460283, 2460284, 2460285, 2460286, 2460287, 2460288, 2460289, 2460290, 2460291, 2460292, 2460293, 2460294, 2460295, 2460296, 2460297, 2460298, 2460299, 2460300, 2460301, 2460302, 2460303, 2460304, 2460305, 2460306, 2460307, 2460308, 2460309, 2460310

Of these 365 numbers, 23 are prime. They are:

2459953, 2459957, 2459993, 2460013, 2460043, 2460061, 2460083, 2460097, 2460113, 2460127, 2460137, 2460151, 2460179, 2460181, 2460187, 2460193, 2460197, 2460217, 2460229, 2460277, 2460281, 2460299, 2460301

To convert a JDN to date time format, the following code (shown in blue) can be used with output in red:

import pandas as pd

juliandate = 2459168.298

t = pd.to_datetime(juliandate, origin='julian', unit='D')

print(t)

2020-11-14 19:09:07.200000

Applying this to the JDN's that are prime, we get the result shown in Figure 2.


Figure 2: permalink

It should be borne in mind that times are in UTC or Coordinated Universal Time and for Jakarta, 7 hours must be added. Since the Julian day begins at midday UTC, this means that in Jakarta the new day starts at 7 pm. I'm writing this at 9:55am on 18th February 2023 but the Julian Day time is 2459993.622 ... and the JDN (2459993) corresponds to 17th February 2023.

Wednesday 15 February 2023

Special Numbers, Special Dates

On the 26th January 2023, I posted about Turning Dates Into Numbers and made the observation that the 10th February 2023 was a special day because the number associated with this date (20230210) had the interesting property that it was the only date in the year that produced a number that had seven distinct prime factors:

20230210 = 2 x 5 x 7 x 11 x 13 x 43 x 47

It turns out that this number has another interesting property in that the sum of its digits equals the last two digits (representing the day of the month). In fact, it begins a run of ten consecutive numbers that end with 20230219 (the 19th February 2023) ... permalink:

20230210, 20230211, 20230212, 20230213, 20230214, 20230215, 20230216, 20230217, 20230218, 20230219

Another run of ten similar numbers occurs in November, starting on the 10th and ending on the 19th.

20231110, 20231111, 20231112, 20231113, 20231114, 20231115, 20231116, 20231117, 20231118, 20231119

For many, many years to come, the sum of the digits of the numbers associated with the dates will always contain two digits. Today is the 15th February 2023 and so we are into the second half of the first-mentioned run.

This number can be expressed as a sum of three cubes
See Figure 2

Similar runs will occur every year but the dates will differ naturally. For example, in 2024, the first run of numbers will begin on 11th January 2024 with 20240111 and end on 19th January 2024 with 20240119. 

In my previous post Turning Dates Into Numbers I looked at what numbers were prime, semiprime and so on. In this post I'll turn my attention to cubes and see what numbers can be expressed as the sum of two cubes and as a sum of three cubes. 

It turns out that there is only one number in the entire year that can be expressed as a sum of two cubes and that is \( 20231020 = 69^3 + 271^3\). This corresponds to the 20th October 2023.

The sums of three cubes are more common. The complete list is shown in Figure 2, arranged in chronological order with 20th January being the first date and 26th December the last.


Figure 2: permalink

It can be noted that some dates produce numbers that can be expressed as sums of three cubes in more than one way. Specifically, 20230426 (two ways), 20230523 (two ways), 20230722 (two ways), 20230904 (two ways), 20230911 (three ways), 20231028 (two ways) and 20231226 (two ways). Thus the 11th September (the famous 911 in United States date format) produces the only number (20230911) that can be expressed as a sum of three cubes in three ways.

Tuesday 14 February 2023

Divisibility of Integers by their Totients

I got to thinking about the conditions for a number to be divisible by its totient. It didn't take too long to see the pattern. Figure 1 shows the results for numbers up to 1024.


Figure 1: permalink

Clearly condition is that the numbers must by of the form \(2^p3^q\) where \(p>0\) and \(q \geq 0\). There are only 35 numbers in this range and, if we extend the range to 10 million, there are still only 178 numbers that satisfy.

These numbers form OEIS A007694:


 A007694

Numbers \(k\) such that \( \phi(k) \) divides \(k\).   
          

The initial members of the sequence are:

1, 2, 4, 6, 8, 12, 16, 18, 24, 32, 36, 48, 54, 64, 72, 96, 108, 128, 144, 162, 192, 216, 256, 288, 324, 384, 432, 486, 512, 576, 648, 768, 864, 972, 1024, 1152, 1296, 1458, 1536, 1728, 1944, 2048, 2304, 2592, 2916, 3072, 3456, 3888, 4096, 4374, 4608, 5184, 5832, 6144, 6912, 7776, 8192, 8748, 9216

The numbers must be even, that is they must contain a power of 2. If the numbers are only powers of 3 then the dividend is 1.5. Figure 2 shows the results in the range up to one million. All numbers are of the form \(3^p\) where \(p>0\).


Figure 2: permalink

What sort of numbers will produce a dividend of 2.5? Well, as it turns out, numbers of the form \(2^p5^q\) where \(p>1\) and \(q>1\). See Figure 3 for the numbers in the range up to one thousand.


Figure 3: permalink

A dividend of 3.5 is produced by numbers of the from \(2^p3^q7^r \) where \(p>0\), \(q>0\) and \(r>0\). See Figure 4 for the numbers in the range up to one thousand.


Figure 4: permalink

Numbers involving 11 as a factor appear if the dividend is 2.2 where numbers are of the form \(2^p11^q\) where \(p>0\) and \(q>0\). See Figure 5 where the range is up to ten thousand.


Figure 5: permalink

Numbers of the from \(2^p11^q23^q\) with \(p>0\), \(q>0\) and \(r>0\) produce a dividend of 2.3. See Figure 6 where the range is up to 100,000.


Figure 6: permalink

Numbers of the form \(2^p3^q31^r\) where \(p>0\), \(q>0\) and \(r>0\) produce a dividend of 3.1. Figure 7 shows the range up to ten thousand.


Figure 7: permalink

Numbers of the form \(2^p3^q11^r\) where \(p>0\), \(q>0\) and \(r>0\) produce a dividend of 3.3. See Figure 8 for numbers in the range up to one thousand.


Figure 8: permalink

More numbers emerge when we consider dividends like 3.25 and 3.75 but I'll stop there even though there is clearly room for further study of this topic. The following is a summary of what I found so far:
  • \( \dfrac{n}{\phi(n)}=k\) where \(k>0\) if numbers of form \(2^p3^q\) with \(p>0\) and \(q \geq 0\)
  • \( \dfrac{n}{\phi(n)}=1.5\) if numbers of form  \(3^p\) with \(p>0\)
  • \( \dfrac{n}{\phi(n)}=2.2\) if numbers of form  \(2^p11^q\) where \(p>0\) and \(q>0\)
  • \( \dfrac{n}{\phi(n)}=2.3\) if numbers of form \(2^p11^q23^q\) with \(p>0\), \(q>0\) and \(r>0\)
  • \( \dfrac{n}{\phi(n)}=2.5\) if numbers of form \(2^p5^q\) with \(p>0\) and \(q>0\)
  • \( \dfrac{n}{\phi(n)}=3.1\) if numbers of form \(2^p3^q31^r\) where \(p>0\), \(q>0\) and \(r>0\)
  • \( \dfrac{n}{\phi(n)}=3.3\) if numbers of form \(2^p3^q11^r\) where \(p>0\), \(q>0\) and \(r>0\)
  • \( \dfrac{n}{\phi(n)}=3.5\) if numbers of form \(2^p3^q7^r \) with \(p>0\), \(q>0\) and \(r>0\)

Sunday 12 February 2023

Kempner Series

I came upon this series quite by accident when investigating what are called Kempner numbers and the Kempner function. Both of these are quite different to the Kempner series defined by Wolfram Mathworld as follows:

A Kempner series \(K_d\) is a series obtained by removing all terms containing a single digit \(d\) from the harmonic series. Surprisingly, while the harmonic series diverges, all 10 Kempner series converge.

The example is given of:$$ K_1= \frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}+\frac{1}{6}+\frac{1}{7}+\frac{1}{8}+\frac{1}{9}+\frac{1}{22}+ \dots $$where it can be seen that the fractions 1/1, 1/10, 1/11 etc. have been removed from the harmonic series. In general: $$ \sum_{k=1}^{\infty} \frac{1}{k} \approx 10^n \ln{10}$$when a particular string of length \(n\) is excluded. Thus, when removing the digit 1, the result is about 23.0258509299405. It takes a lot of terms to approach this number. After one million terms, the total is only about 7.717.

Another example is given of removing the string "314" which gives an approximation of 2302.58509299405 (just move the decimal place two to the right) whereas the actual result is closer to 2299.829782. Quite a good approximation. This convergence is surprising given that removing all the composite numbers in the harmonic series still results in its divergence.

So what about Kempner numbers and the Kempner function? The number associated with my diurnal age today, 26978, has a property that qualifies it for inclusion in OEIS A346211:


 A346211

Numbers m such that \( |(K(m+1) - K(m)| = 1\), where \(K(m)\) = A002034(\(m\)) is the Kempner function.



This is where I first came across the word "Kempner". The initial members of the sequence are:

1, 2, 3, 4, 9, 15, 35, 63, 99, 175, 195, 483, 1443, 2057, 2115, 2299, 3363, 3843, 5082, 5475, 6723, 7865, 11235, 11913, 12005, 22747, 24963, 26978, 27555, 31683, 37635, 41514, 46255, 51075, 62464, 68643, 76704, 77283, 89375, 95874, 98595, 104975, 105412, 113398

Following the link to the Kempner function, OEIS A002034, leads to the reference to Kempner numbers:


 A002034

Kempner numbers: smallest positive integer \(m\) such that \(n\) divides \(m\)!.



The initial members of this sequence are:

1, 2, 3, 4, 5, 3, 7, 4, 6, 5, 11, 4, 13, 7, 5, 6, 17, 6, 19, 5, 7, 11, 23, 4, 10, 13, 9, 7, 29, 5, 31, 8, 11, 17, 7, 6, 37, 19, 13, 5, 41, 7, 43, 11, 6, 23, 47, 6, 14, 10, 17, 13, 53, 9, 11, 7, 19, 29, 59, 5, 61, 31, 7, 8, 13, 11, 67, 17, 23, 7, 71, 6, 73, 37, 10, 19, 11, 13, 79, 6, 9, 41, 83, 7

The Kempner function is also known as the Smarandache Function which Wolfram Mathworld describes as:
The Smarandache function \( \mu(n) \) is the function first considered by Lucas (1883), Neuberg (1887), and Kempner (1918) and subsequently rediscovered by Smarandache (1980) that gives the smallest value for a given n at which \(n|\mu(n)!\) (i.e., \(n\) divides \( \mu(n)\) factorial). For example, the number 8 does not divide 1!, 2!, 3!, but does divide 4!=4·3·2·1=8·3, so \( \mu(8)=4\). This function has the property that it has a highly inconsistent growth rate: it grows linearly on the prime numbers but only grows sublogarithmically at the factorial numbers. 
The graph of the function is interesting. See Figure 1.


Figure 1: link

Saturday 11 February 2023

Revisiting Hyperperfect Numbers

I made a post titled Multiperfect, Hyperfect and Superperfect Numbers on the 24th July 2019 and another titled Hemiperfect Numbers on the 3rd January 2021. These terms can be confusing and these two posts require a careful reading in order to clarify the distinctions between the types of numbers. In today's post, I'm just revisiting the hyperperfect numbers.

The reason for my revisit is that my diurnal age today, 26977, qualifies it for membership in OEIS A034897:


 A034897

Hyperperfect numbers: \(n\) such that \(n = 1 + k(\sigma(n)-n-1)\) for some \(k > 0\).   
        


To quote from the first mentioned blog post:

A number \(n\) is called \(k\)-hyperperfect if$$n=1+k \, \sum_i d_i=1+k \,(\sigma(n)-n-1)$$where \( \sigma(n)\) is the divisor function and the summation is over the proper divisors with \(1<d_i<n\). Figure 1 shows a table of the first few hyperperfect numbers where \(k=1\) returns the perfect numbers:

Figure 1

What OEIS A034897 shows however, are all the hyperfect numbers regardless of the value of \(k\). Figure 2 shows a table of the initial hyperperfect numbers together with their corresponding \(k\) values.


Figure 2: permalink

Here is a fuller list of hyperperfect numbers but without \(k\) values, up to those that are a little over one million:

6, 21, 28, 301, 325, 496, 697, 1333, 1909, 2041, 2133, 3901, 8128, 10693, 16513, 19521, 24601, 26977, 51301, 96361, 130153, 159841, 163201, 176661, 214273, 250321, 275833, 296341, 306181, 389593, 486877, 495529, 542413, 808861, 1005421, 1005649, 1055833

As can be seen, 226977 is a 48-hyperperfect number and the last hyperperfect number that I will encounter in my lifetime (when considering my diurnal age). The next one is 51301 by which time I will be long gone. Thus for 26977 we have:$$ \begin{array} 226977 &=1+48 \times \, \sum_i d_i\\ &=1+48 \times \,(\sigma(26977)-26977-1)\\ &=1+48 \times (27540-26977-1)\\ &=1+48 \times 562\\&=26977 \end{array} $$Here is a link to the Wikipedia article about hyperfect numbers.