Sunday, 29 January 2023

Iteration: Reverse and Add Sum of Digits

My previous post, titled Iteration: Reverse and Subtract Maximum Digit, encouraged me to look at some variants on this theme. I discovered that Reverse and Add Sum of Digits is interesting. In the range up to 100,000, this iteration always produces a loop. The trajectory of maximum length is achieved by 84761 with a length of 126. Here is the trajectory:

84761, 16774, 47786, 68806, 60914, 41926, 62936, 63952, 25961, 16975, 57989, 99013, 31121, 12121, 12128, 82135, 53147, 74155, 55169, 96181, 18194, 49204, 40313, 31315, 51326, 62332, 23342, 24346, 64361, 16366, 66383, 38392, 29408, 80515, 51527, 72535, 53549, 94561, 16574, 47584, 48602, 20704, 40715, 51721, 12731, 13735, 53750, 5755, 5597, 7981, 1922, 2305, 5042, 2416, 6155, 5533, 3371, 1747, 7490, 967, 791, 214, 419, 928, 848, 868, 890, 115, 518, 829, 947, 769, 989, 1015, 5108, 8029, 9227, 7249, 9449, 9475, 5774, 4798, 9002, 2020, 206, 610, 23, 37, 83, 49, 107, 709, 923, 343, 353, 364, 476, 691, 212, 217, 722, 238, 845, 565, 581, 199, 1010, 103, 305, 511, 122, 226, 632, 247, 755, 574, 491, 208, 812, 229, 935, 556, 671, 190, 101, 103

Figure 1 shows a graph of the trajectory.


Figure 1: permalink

Figure 2 shows the same graph by with a logarithmic scale for the y axis.


Figure 2: permalink

Figure 3 shows a plot of the trajectory lengths for the first 100,000 numbers.


Figure 3: permalink

The average trajectory length is a little of over 43. As the numbers get bigger, it's not surprising that the trajectory lengths grow larger. For example, take the set of numbers corresponding to the dates in 2023 (see Turning Dates Into Numbers). For this set of numbers, the average trajectory length is a little over 72 and the record is achieved by 20230518 (corresponding to 18th May 2023) with a trajectory length of 162:

20230518, 81503223, 32230542, 24503244, 44230566, 66503274, 47230599, 99503313, 31330632, 23603334, 43330656, 65603364, 46330689, 98603403, 30430722, 22703424, 42430746, 64703454, 45430779, 97703493, 39430821, 12803523, 32530845, 54803553, 35530878, 87803592, 29530920, 2903622, 2263116, 6113643, 3463140, 413664, 466338, 833694, 496371, 173724, 427395, 593754, 457428, 824784, 487461, 164814, 418485, 584844, 448518, 815874, 478551, 155904, 409575, 575934, 439608, 806964, 469641, 146994, 499674, 477033, 330798, 897063, 360831, 138084, 480855, 558114, 411879, 978144, 441912, 219165, 561936, 639195, 591969, 969234, 433002, 200346, 643017, 710367, 763041, 140388, 883065, 560418, 814089, 980448, 844122, 221469, 964146, 641499, 994179, 971538, 835212, 212559, 955236, 632589, 985269, 962628, 826302, 203649, 946326, 623679, 976359, 953718, 817392, 293748, 847425, 524778, 877458, 854817, 718491, 194847, 748524, 425877, 778557, 755916, 619590, 95946, 64992, 29976, 68025, 52107, 70140, 4119, 9129, 9240, 444, 456, 669, 987, 813, 330, 39, 105, 507, 717, 732, 249, 957, 780, 102, 204, 408, 816, 633, 348, 858, 879, 1002, 2004, 4008, 8016, 6123, 3228, 8238, 8349, 9462, 2670, 777, 798, 921, 141, 147, 753, 372, 285, 597, 816

Figure 4 shows a graph of this trajectory:


Figure 4: permalink

Figure 5 shows the same trajectory but uses a logarithmic scale for the y axis:


Figure 5: permalink

I suspect that a loop is eventually reached for any number, no matter how large. However, I can't prove this but a proof may be possible. This iteration that I've just examined is just another of many possible iterations and I may investigate others at a future date.

Saturday, 28 January 2023

Iteration: Reverse and Subtract Maximum Digit

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


 A097155

Numbers that reach the fixed point 89 under iteration of f(x) = reverse(x) - maxdigit(x).



In the range up to 40,000, there are only 45 numbers with this property. They are:

89, 890, 998, 2125, 3126, 5207, 6207, 7018, 7019, 8099, 8900, 9098, 9899, 9980, 10151, 10152, 10224, 12205, 12259, 12268, 14085, 14086, 15095, 15096, 17972, 18971, 21250, 22015, 22269, 23077, 24005, 24086, 24087, 25096, 26963, 27962, 30225, 31116, 31260, 33006, 33077, 33078, 34087, 35954, 36953

The remaining 39955 numbers end in zero. Here is a permalink to the calculation that generated these numbers. Let's follow the trajectory of 26963 (permalink):

26963, 36953, 35954, 45944, 44945, 54935, 53936, 63926, 62927, 72917, 71918, 81908, 80909, 90899, 99800, 890, 89

ONLY 0 AND 89 REMAIN INVARIANT
UNDER THE OPERATION OF
REVERSE AND SUBTRACT LARGEST DIGIT

Figure 1 shows the trajectory of 26963. Note how 99800 collapses to 899 when it's reversed, leading quickly to 89.


Figure 1: trajectory of 26963

Compare this trajectory to that 26962 (see What's Special About 26962?) and most other numbers (permalink):

26962, 26953, 35953, 35944, 44944, 44935, 53935, 53926, 62926, 62917, 71917, 71908, 80908, 80899, 99799, 99790, 9790, 970, 70, 0

Figure 2 shows the trajectory of 26962 which is similar to that of 26963, except that it collapses to 0.


Figure 2: trajectory of 26962

If we look at the numbers corresponding to the dates in 2023 (see Turning Dates Into Numbers), there are only two numbers that lead to in 89 and these are (permalink):
  • 20230213 corresponding to the 13th February 2023
  • 20231112 corresponding to the 12th November 2023
The numbers corresponding to the other 363 dates all end in zero.

In the range up to 100,000, there are 124 numbers that end in 89 making for a percentage of 0.124% (permalink). Figure 3 shows the distribution of these numbers over the range.


Figure 3

What's Special About 26962?

I'm following my tradition of making a special post for my palindromic days. The last one was 26862 and titled What's Special About 26862? Now I've reached 26962 and this palindrome has some interesting properties. The first is that it can be split up into two factors, each of which is the reverse of the other (with square numbers such as 121 excluded).

26962 = 122 x 221 = 221 x 122

There are not many palindromes with this property in the range up to one million. Here is the list:

  • 252 =12 x 21 = 21 x 12
  • 20502 = 102 x 201 = 201 x 102
  • 23632 = 112 x 211 = 211 x 112
  • 26962 = 122 x 221 = 221 x 122
As can be seen, 26962 is last palindrome with this property in the range up to one million. We have to extend the range in order to find more. In the range between one and two million, the following palindromes are found (permalink):
  • 1113111 = 1011 x 1101 = 1101 x 1011
  • 1226221 = 1021 x 1201 = 1201 x 1021
  • 1357531 = 1121 x 1211 = 1211 x 1121
Notice how all the factors are comprised of the digits 0, 1 and 2 only. If we relax the rule that square numbers are excluded then, with their inclusion, 26962 is a member of OEIS A158642:


 A158642

Palindromic numbers which are the product of a number n and its reversal (n written backwards)



The members of this sequence, up to two million, are:

0, 1, 4, 9, 121, 252, 484, 10201, 12321, 14641, 20502, 23632, 26962, 40804, 44944, 1002001, 1113111, 1226221, 1234321, 1357531

The previously mentioned non-square numbers are marked in blue.

********************************************

26962 is a palindrome which is 
a product of a pair of emirpimes

In the case of 26962, it can be noted that the factors 122 and 221 are emirpimes:
  • 122 = 2 x 61
  • 221 = 13 x 17
This property of being a product of emirpimes qualifies 26962 for membership in OEIS A158126:


 A158126

Products of emirpimes pairs, sorted.                                    


The initial members of the sequence are:

765, 1612, 3627, 4606, 4930, 26962, 39483, 48763, 58765, 61306, 69723, 85405, 102910, 107485, 118809, 129682, 134458, 136467, 140572, 146047, 148930, 151209, 155038, 162409, 178555, 194242, 196315, 203098, 213310, 236421, 283798, 291247

********************************************

26962 is a palindrome 
with four distinct prime factors

26962 has four distinct prime factors: 2, 13, 17 and 61. Palindromes with this property are fairly rare and constitute OEIS A046394

 
 A046394

Palindromes with exactly four distinct prime factors.                              



The initial members of this sequence, up to 100,000, are (permalink):

858, 2002, 2442, 3003, 4774, 5005, 5115, 6666, 10101, 15351, 17871, 22422, 22722, 24242, 26562, 26962, 28482, 35853, 36363, 41314, 43734, 43834, 45654, 47874, 49494, 49794, 49894, 51015, 51315, 51415, 53535, 53835, 53935, 56865, 58485, 59295, 59595, 60006, 62526, 62826, 64246, 64446, 66666, 66766, 68286, 73437, 74347, 78387, 81618, 81718, 83638, 83838, 87078, 87178, 89598, 89698, 92829, 96369, 98889

26962 is also a palindrome in base 11, being represented as 19291. This property qualifies it for membership in OEIS A180454.

********************************************

26962 can be written as a sum of two distinct palindromic primes in three different ways

Still on the topic of palindromes, 26962 is a member of OEIS A356854:


 A356854

Palindromes that can be written in more than one way as the sum of two distinct palindromic primes.



The primes are 10301 + 16661 = 10601 + 16361 = 11411 + 15551 = 26962.

The initial members of the sequence are (permalink):

282, 484, 858, 888, 21912, 22722, 23832, 24642, 25752, 26662, 26762, 26862, 26962, 27672, 27772, 27872, 27972, 28482, 28782, 28882, 28982, 29692, 29792, 29892, 29992, 40704, 41514, 41614, 41814, 42624, 42824, 42924, 43434, 43734, 43834, 43934, 44744, 44844, 44944, 45354

********************************************

26962 is a palindromic Ulam number

26962 is also an Ulam number and so, being a palindromic Ulam number, it qualifies for membership in OEIS A173542:


 A173542

Palindromic Ulam numbers.   
                                       


The initial members of the sequence are:

1, 2, 3, 4, 6, 8, 11, 77, 99, 131, 282, 363, 414, 434, 585, 646, 949, 2112, 2332, 2552, 2662, 5335, 5665, 8008, 8338, 8668, 10501, 13531, 13931, 15251, 16961, 17071, 18381, 18581, 18681, 22122, 22322, 23632, 23932, 25452, 26962, 28582, 28682, 30703, 30803, 32123

Thursday, 26 January 2023

Turning Dates Into Numbers

26th January 2023 --> 20230126

There are a variety of ways in which a unique date could be converted into a unique number but perhaps the most logical is the concatenation of year, month and day to generate the number. For example, today's date is 26th January 2023 and thus the concatenation of 2023, 01 and 26 produces 20230126. The leading zero is important or else ambiguity occurs with certain dates. For example, 11th January 2023 produces 2023111 but the 1st November 2023 will also produce 2023111. For this reason, the format YYYYMMDD with leading zeros included must be followed.

Follow this link for SageMath code to generate the output below.

The numbers increase by 1 with each passing day and every number is unique and can thus be examined for whatever properties are of interest. Each year will produce 365 numbers or 366 numbers when there is a leap year. Let's look at the numbers that are produced for the year 2023:

20230101, 20230102, 20230103, 20230104, 20230105, 20230106, 20230107, 20230108, 20230109, 20230110, 20230111, 20230112, 20230113, 20230114, 20230115, 20230116, 20230117, 20230118, 20230119, 20230120, 20230121, 20230122, 20230123, 20230124, 20230125, 20230126, 20230127, 20230128, 20230129, 20230130, 20230131, 20230201, 20230202, 20230203, 20230204, 20230205, 20230206, 20230207, 20230208, 20230209, 20230210, 20230211, 20230212, 20230213, 20230214, 20230215, 20230216, 20230217, 20230218, 20230219, 20230220, 20230221, 20230222, 20230223, 20230224, 20230225, 20230226, 20230227, 20230228, 20230301, 20230302, 20230303, 20230304, 20230305, 20230306, 20230307, 20230308, 20230309, 20230310, 20230311, 20230312, 20230313, 20230314, 20230315, 20230316, 20230317, 20230318, 20230319, 20230320, 20230321, 20230322, 20230323, 20230324, 20230325, 20230326, 20230327, 20230328, 20230329, 20230330, 20230331, 20230401, 20230402, 20230403, 20230404, 20230405, 20230406, 20230407, 20230408, 20230409, 20230410, 20230411, 20230412, 20230413, 20230414, 20230415, 20230416, 20230417, 20230418, 20230419, 20230420, 20230421, 20230422, 20230423, 20230424, 20230425, 20230426, 20230427, 20230428, 20230429, 20230430, 20230501, 20230502, 20230503, 20230504, 20230505, 20230506, 20230507, 20230508, 20230509, 20230510, 20230511, 20230512, 20230513, 20230514, 20230515, 20230516, 20230517, 20230518, 20230519, 20230520, 20230521, 20230522, 20230523, 20230524, 20230525, 20230526, 20230527, 20230528, 20230529, 20230530, 20230531, 20230601, 20230602, 20230603, 20230604, 20230605, 20230606, 20230607, 20230608, 20230609, 20230610, 20230611, 20230612, 20230613, 20230614, 20230615, 20230616, 20230617, 20230618, 20230619, 20230620, 20230621, 20230622, 20230623, 20230624, 20230625, 20230626, 20230627, 20230628, 20230629, 20230630, 20230701, 20230702, 20230703, 20230704, 20230705, 20230706, 20230707, 20230708, 20230709, 20230710, 20230711, 20230712, 20230713, 20230714, 20230715, 20230716, 20230717, 20230718, 20230719, 20230720, 20230721, 20230722, 20230723, 20230724, 20230725, 20230726, 20230727, 20230728, 20230729, 20230730, 20230731, 20230801, 20230802, 20230803, 20230804, 20230805, 20230806, 20230807, 20230808, 20230809, 20230810, 20230811, 20230812, 20230813, 20230814, 20230815, 20230816, 20230817, 20230818, 20230819, 20230820, 20230821, 20230822, 20230823, 20230824, 20230825, 20230826, 20230827, 20230828, 20230829, 20230830, 20230831, 20230901, 20230902, 20230903, 20230904, 20230905, 20230906, 20230907, 20230908, 20230909, 20230910, 20230911, 20230912, 20230913, 20230914, 20230915, 20230916, 20230917, 20230918, 20230919, 20230920, 20230921, 20230922, 20230923, 20230924, 20230925, 20230926, 20230927, 20230928, 20230929, 20230930, 20231001, 20231002, 20231003, 20231004, 20231005, 20231006, 20231007, 20231008, 20231009, 20231010, 20231011, 20231012, 20231013, 20231014, 20231015, 20231016, 20231017, 20231018, 20231019, 20231020, 20231021, 20231022, 20231023, 20231024, 20231025, 20231026, 20231027, 20231028, 20231029, 20231030, 20231031, 20231101, 20231102, 20231103, 20231104, 20231105, 20231106, 20231107, 20231108, 20231109, 20231110, 20231111, 20231112, 20231113, 20231114, 20231115, 20231116, 20231117, 20231118, 20231119, 20231120, 20231121, 20231122, 20231123, 20231124, 20231125, 20231126, 20231127, 20231128, 20231129, 20231130, 20231201, 20231202, 20231203, 20231204, 20231205, 20231206, 20231207, 20231208, 20231209, 20231210, 20231211, 20231212, 20231213, 20231214, 20231215, 20231216, 20231217, 20231218, 20231219, 20231220, 20231221, 20231222, 20231223, 20231224, 20231225, 20231226, 20231227, 20231228, 20231229, 20231230, 20231231

A question could be asked such as how many of these numbers are prime? Well, as it turns out, only 18 and these are:

20230103, 20230109, 20230121, 20230201, 20230219, 20230303, 20230411, 20230517, 20230519, 20230619, 20230621, 20230831, 20230919, 20231011, 20231017, 20231023, 20231129, 20231203

It's easy enough to write an algorithm (permalink) to return these numbers to their equivalent dates.

03 - 01 - 2023

09 - 01 - 2023

21 - 01 - 2023

01 - 02 - 2023

19 - 02 - 2023

03 - 03 - 2023

11 - 04 - 2023

17 - 05 - 2023

19 - 05 - 2023

19 - 06 - 2023

21 - 06 - 2023

31 - 08 - 2023

19 - 09 - 2023

11 - 10 - 2023

17 - 10 - 2023

23 - 10 - 2023

29 - 11 - 2023

03 - 12 - 2023

My habit is to investigate the number associated with my diurnal age, meaning the number of days that have elapsed since I was born, counting the day I was born as day zero. These numbers have a personal significance and are only shared by individuals born on the same date as myself, namely 3rd April 1949. A more impersonal investigation could be carried out using the numbers associated with the daily date. The only drawback is that these eight digit numbers often turn up nothing in the OEIS or Online Encyclopedia of Integer Sequences. For example, today's number of 20230126 turns up nothing. See Figure 1.


Figure 1

The OEIS is my major source of information about numbers and their properties so this is unfortunate. Numbers Aplenty, my next most popular source of information, does generate some output. See Figure 2.


Figure 2

These numbers offer an opportunity to investigate larger numbers because my diurnal age is limited to five digit numbers (I am 26961 days old). Take today's number of 20231026. This number has four distinct prime factors (2, 7, 97 and 14897) and so the question could be asked: how many dates in 2023 produce numbers that have four distinct prime factors? The answer is 52 and these are:

20230105, 20230114, 20230122, 20230126, 20230206, 20230215, 20230221, 20230223, 20230226, 20230302, 20230305, 20230306, 20230315, 20230322, 20230323, 20230330, 20230401, 20230406, 20230410, 20230413, 20230414, 20230419, 20230422, 20230503, 20230507, 20230509, 20230602, 20230606, 20230611, 20230706, 20230710, 20230719, 20230727, 20230730, 20230806, 20230815, 20230914, 20230917, 20230922, 20231003, 20231007, 20231029, 20231030, 20231102, 20231105, 20231106, 20231110, 20231115, 20231130, 20231214, 20231222, 20231230

Overall it can be said that in 2023 there are:

  • 18 primes
  • 66 semiprimes with distinct prime factors
  • 82 sphenic numbers
  • 51 numbers with four distinct prime factors
  • 11 numbers with five distinct prime factors
  • 1 number with seven distinct prime factors (20230210 → 10-02-2023)

Thus it can be seen that the 10th February 2023 produces the only number that has seven distinct prime factors. 

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

It can also be noted that no palindromic number is possible this year. Here are the numbers that are palindromic between 2000 up to 2090 (I hope it's complete):

  • 20011002
  • 20100102
  • 20111102
  • 20211202
  • 20300302
  • 20400402
  • 20500502
  • 20600602
  • 20700702
  • 20800802
  • 20900902

This year the smallest number, 20230101, and the largest, 20231231, have a difference of 1130 but only 365 numbers in this range are possible in terms of dates.

So we'll see what comes of this. It's another mathematical toy to play around with. See my post The Julian Day Number on the 16th February 2023 for information that relates to this problem of numbering the days of each year.

Thursday, 19 January 2023

What's Special About 8341?

This number came completely out of left field. I was watching a video about China in which the number was mentioned in reference to Mao Zedong. Figure 1 shows a screenshot from the video. I was embed the video as the link is bound to disappear over time but a hyperlink is included in the caption.

Figure 1: link

The significance of the number is as follows:
The Beijing-based Central Security Regiment, also known as the 8341 Unit, was an important PLA (People's Liberation Army) law enforcement element. It was responsible over the years for the personal security of Mao Zedong and other party and state leaders. More than a bodyguard force, it also operated a nationwide intelligence network to uncover plots against Mao or any incipient threat to the leadership. The unit reportedly was deeply involved in undercover activities, discovering electronic listening devices in Mao's office and performing surveillance of his rivals. The 8341 Unit participated in the late 1976 arrest of the Gang of Four, but it reportedly was deactivated soon after that event.
The above quote is from a website that was last updated on May 22nd 1998. In the video the narrator makes the claim that it was during the Long March in the mid-1930's when the Red Army retreated to Tibet that Mao met a Tibetan lama who gave him the number 8341. Mao later named his personal security detail the 8341 Corps.


The significance of the number only became apparent after Mao's death in 1976 because he had been in absolute control of the Communist Party for 41 years (since November 1935) and he was 83 years old when he died. Coincidence? Perhaps but in any case the number 8341 indisputably a concatenation of his age at the time of his death (83) and the number of years he had been in control of the party (41). 

8341 is a concatenation of Mao Zedong's age (83) at the time of his death and the number of years (41) that he was in control of the CCP

Whether coincidence of not, the number 8341 is now inextricably linked to Mao Zedong. However, there are other stories about how the number was chosen for the unit. This source mentions:
The most widely circulated legend is that when Mao Zedong was young, an old Taoist priest measured his life with him, and left the four numbers 8341, and Mao Zedong used these four characters as the code name of this unit.

Another argument: Mao Zedong joined the army in southern Hunan when he was young. The number on the first gun he got was 8341, so Mao Zedong has always been obsessed with this number. When he gave the army a code name, he gave them 8341 as the code name.
Another source dismisses all of this speculation and states that:
People have had a lot of speculation about the origin of the 8341 unit , giving the number 8341 a lot of mysterious meaning. But these mysterious speculations are not true. Every unit of the People's Liberation Army has a code name, one for simplicity and the other for confidentiality. This code was assigned by the General Staff to the whole army, not by a fortune-teller.

The predecessor of Unit 8341 was the Jinggangshan Military Special Service Company established in May 1928, which was responsible for defending the central leadership. On October 20, 1942, it was renamed the Central Guard Corps of the Communist Party of China .

After stationing in Peiping in May 1949, the Central Guard Corps was expanded into the Central Guard Division . In May 1953, on the basis of the First Regiment of the Central Guard Division, a new CCP Central Guard Regiment was adjusted and enriched . Since then, the code name of the Central Guard Corps has become 8341. 
Since 1976, its code name has been changed to 57001 . The name 8341 withdrew from the stage of history.

However, the most popular account of why this number was chosen relates to Mao's visit to a Taoist monk and is similar to the Tibetan lama story, except for the difference in religions. It is explained in detail in this YouTube video. Figure 2 shows a screenshot from the video.


Figure 2: link

Wednesday, 18 January 2023

What's Special About 516493?

5 1 6 4 9 3

I got to thinking about primes that remain prime under the operation of prime + digit sum. The acronym "sod" standing for sum of digits is commonly used in this context. There are many primes that satisfy. For example, 11 has a digit sum of 2 and 11 + 2 = 13 which is prime. If we repeat the operation we get 13 + 4 = 17 which is still prime. However, repeating the operation again yields 17 + 8 = 25 which is composite.

The primes that remain prime for only one application of the prime + sod operation constitute OEIS A048523 (permalink):


 A048523

 Primes for which only one iteration of 'Prime plus its digit sum equals a prime' is possible.



The initial members are:

13, 19, 37, 53, 71, 73, 97, 103, 127, 163, 181, 233, 271, 307, 383, 389, 431, 433, 499, 509, 563, 587, 631, 701, 743, 787, 811, 857, 859, 947, 1009, 1049, 1061, 1087, 1153, 1171, 1223, 1283, 1423, 1483, 1489, 1553, 1597, 1601, 1607, 1733, 1801, 1861, 1867

There are 7939 such primes in the range up to one million. Notice that 11 is not included here because it produces a prime again. The primes, like 11, that remain prime for only two applications of the prime + sod operation constitute OEIS A048524 (permalink):


 A048524

Primes for which only two iterations of 'Prime plus its digit sum equals a prime' are possible.



The initial members of the sequence are:

11, 59, 101, 149, 167, 257, 293, 367, 419, 479, 547, 617, 727, 839, 1409, 1579, 1847, 2039, 2129, 2617, 2657, 2837, 3449, 3517, 3539, 3607, 3719, 4217, 4637, 4877, 5689, 5807, 5861, 6037, 6257, 6761, 7027, 7517, 8039, 8741, 8969, 9371, 9377, 10667

There are 1111 such primes in the range up to one million. The primes that remain prime for only three applications of the prime + sod operation constitute OEIS A048525 (permalink):


 A048525

Primes for which only three iterations of 'Prime plus its digit sum equals a prime' are possible.



The initial members of the sequence are:

277, 1559, 5779, 7489, 11279, 15091, 22093, 37811, 43579, 46279, 48541, 49957, 53479, 54751, 60589, 68473, 72883, 74821, 83621, 85621, 90793, 91921, 93901, 97501, 107981, 110899, 111799, 120193, 153379, 157739, 170299, 180731, 184441

There are 136 such primes in the range up to one million. The primes that remain prime for only four applications of the prime + sod operation constitute OEIS A048526 (permalink):


 A048526

Primes for which only four iterations of 'Prime plus its digit sum equals a prime' are possible.



The initial members of the sequence are:

37783, 85601, 259631, 268721, 350941, 371939, 378901, 516521, 665111, 733331, 883331, 967781, 1047929, 1056521, 1081721, 1258811, 1427411, 1480573, 1515929, 1584901, 1614929, 1842131, 1875311, 1885981, 2027801, 2044873, 2450531

There are only 12 such primes in the range up to one million. The primes that remain prime for only five applications of the prime + sod operation constitute OEIS A048527 (permalink):


 A048527

Primes for which only five iterations of 'Prime plus its digit sum equals a prime' are possible.



The initial members of the sequence are:

516493, 1056493, 1427383, 1885943, 3166183, 3805183, 4241593, 6621283, 7646953, 12912283, 17987839, 32106493, 107152093, 120224773, 131144473, 133210873, 139388891, 142782877, 150326173, 155382923, 177865819, 184081943, 227795839, 242376877, 264174877

There is only one such prime in the range up to one million and that is 516493 and that is why it is deserving of this special post. The progression is shown below where True = Prime and False = Composite:

516493 True
516521 True
516541 True
516563 True
516589 True
516623 True
516646 False

516493 is the only prime in the range up to one million that generates five successive primes under the prime + sum of digits operation

There are primes that go further than five iterations. For example, 286330897 survives seven iterations (link). This is the progression:

286330897 True
286330943 True
286330981 True
286331021 True
286331047 True
286331081 True
286331113 True
286331141 True
286331170 False

The number 56676324799 survives eight iterations (link). This is the progression:

56676324799 True
56676324863 True
56676324919 True
56676324977 True
56676325039 True
56676325091 True
56676325141 True
56676325187 True
56676325243 True
56676325292 False

Presumably there is no limit to the number of iterations.

Thursday, 12 January 2023

Rotate and Add

26947 is a prime, in fact it's a left truncatable prime. This means that with successive removal of digits from the left, the resulting number is still prime. Thus we have 6947, 947, 47 and 7 all being prime. The number was brought to my attention because it represents my diurnal age today: 12th January 2023. Coincidentally if we write this date as 12-1-2023 and then concatenate the digits to form 1212023, this number too is prime.

However, 26947 is also of interest in connection to a so-called rotate and add operation that can be applied to any integer number. If the number has an even number of digits, let's say 1234, then we divide the number into two parts of equal length (12|34) and swap the two parts (34|12) to form 3412. If the number has an odd number of digits, let's say 12345, then we leave the central digit unchanged (12|3|45) but swap the left and right hand parts (45|3|12) to form 45312.

Let's consider primes in the range up to 1000. How many of them will remain prime under this operation. These are the primes that remain prime:

229, 239, 241, 257, 269, 271, 277, 281, 439, 443, 463, 467, 479, 499, 613, 641, 653, 661, 673, 677, 683, 691, 811, 823, 839, 863, 881

Let's take 229 as an example. The operation leads to its rotation (where it becomes 922) and its addition to its rotated form (229 + 922) leads to 1151 which is prime. Primes such as these form OEIS A086002:


 A086002

Primes which when added to their own rotation yield a prime.     
                     


26947 is one such prime because its rotation (47926) and its addition to this rotation (26947 + 47926) generates the prime 74873. However, when the operation is applied to this new prime, the result is still a prime. This is because 74873 + 73874 = 148747 which is prime. Primes such as this are much rarer and constitute OEIS A086003:


 A086003

Primes which remain prime after one and after two applications of the rotate-and-add operation of A086002.



The initial members of this sequence are:

271, 281, 10853, 10903, 10939, 12917, 12919, 16603, 16673, 16823, 16843, 18671, 18911, 18913, 20929, 22817, 22907, 24907, 26813, 26833, 26903, 26947, 28661, 28901, 28921, 30809, 30829, 32831, 32917, 32941, 34939, 36653, 36913, 38651

Unfortunately, if we repeat the process, 26947 does not survive but other numbers do and these constitute OEIS A086004


 A086004

Primes which remain prime after one and after two and after three applications of the rotate-and-add operation of A086002.



The initial members of this sequence are (permalink):

12917, 12919, 18911, 18913, 22907, 24907, 26903, 28901, 1088063, 1288043, 1408031, 1428029, 1528019, 100083679, 100280419, 100283849, 100483847, 100692793, 100880413, 101080159, 101283839, 101683093, 101683663, 102080149

None of the primes listed above survive another round but there are larger primes that do and these constitute OEIS A261458:


 A261458

Primes which remain prime after one, two, three and four applications of the rotate-and-add operation of A086002.



The initial members of this sequence are:

10010905789, 10028905771, 10036905763, 10050905749, 10056905743, 10060905739, 10070905729, 10080905719, 10092905707, 10098905701, 10102905697, 10106905693, 10108905691, 10112905687, 10130905669, 10160905639, 10172905627, 10176905623, 10188905611, 10190905609 

In general, it can be noted that rotation and addition of primes with even numbers of digits never yields a prime. This can be seen, using \(ab\) as an example because the rotation \(ba\) and addition generates \(10a+b+10b+a=11a+11b=11 \times (a+b)\) which is composite.

As far as I know, no primes have been found that survive five applications of the operation and according the the comments to OEIS A261458 six applications can never generate a prime.

The rotate and add operation of course does not need to be confined to primes. For example. we could consider semiprimes that remain semiprimes under one, two, three etc. applications of the operation. Such an investigation could form the basis of a future post.

Tuesday, 10 January 2023

Sequences Formed By Removing Zeros

It's interesting to consider what happens to a sequence if a certain rule is applied but with the stipulation that any zeros arising must be removed. If we start with 1, double it and then double the result and continue this process, we end up with an infinite sequence:

1, 2, 4, 6, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, ...

But what happens once any zeros that arise are removed? Well, nothing until 1024 is reached and it becomes 124, then 248, 496 etc. It turns out that the sequence enters a loop (marked in blue below) that has a period of 36. The minimum value within the loop is 28714 and the largest is 11,772,544. The maximum value reached overall is 765,257,552.

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 124, 248, 496, 992, 1984, 3968, 7936, 15872, 31744, 63488, 126976, 253952, 5794, 11588, 23176, 46352, 9274, 18548, 3796, 7592, 15184, 3368, 6736, 13472, 26944, 53888, 17776, 35552, 7114, 14228, 28456, 56912, 113824, 227648, 455296, 91592, 183184, 366368, 732736, 1465472, 293944, 587888, 1175776, 2351552, 47314, 94628, 189256, 378512, 75724, 151448, 32896, 65792, 131584, 263168, 526336, 152672, 35344, 7688, 15376, 3752, 754, 158, 316, 632, 1264, 2528, 556, 1112, 2224, 4448, 8896, 17792, 35584, 71168, 142336, 284672, 569344, 1138688, 2277376, 4554752, 91954, 18398, 36796, 73592, 147184, 294368, 588736, 1177472, 2354944, 479888, 959776, 1919552, 383914, 767828, 1535656, 371312, 742624, 1485248, 297496, 594992, 1189984, 2379968, 4759936, 9519872, 1939744, 3879488, 7758976, 15517952, 313594, 627188, 1254376, 258752, 51754, 1358, 2716, 5432, 1864, 3728, 7456, 14912, 29824, 59648, 119296, 238592, 477184, 954368, 198736, 397472, 794944, 1589888, 3179776, 6359552, 1271914, 2543828, 587656, 1175312, 235624, 471248, 942496, 1884992, 3769984, 7539968, 1579936, 3159872, 6319744, 12639488, 25278976, 5557952, 1111594, 2223188, 4446376, 8892752, 1778554, 355718, 711436, 1422872, 2845744, 5691488, 11382976, 22765952, 4553194, 916388, 1832776, 3665552, 733114, 1466228, 2932456, 5864912, 11729824, 23459648, 46919296, 93838592, 187677184, 375354368, 7578736, 15157472, 3314944, 6629888, 13259776, 26519552, 533914, 167828, 335656, 671312, 1342624, 2685248, 537496, 174992, 349984, 699968, 1399936, 2799872, 5599744, 11199488, 22398976, 44797952, 8959594, 17919188, 35838376, 71676752, 14335354, 286778, 573556, 1147112, 2294224, 4588448, 9176896, 18353792, 3677584, 7355168, 1471336, 2942672, 5885344, 1177688, 2355376, 471752, 94354, 18878, 37756, 75512, 15124, 3248, 6496, 12992, 25984, 51968, 13936, 27872, 55744, 111488, 222976, 445952, 89194, 178388, 356776, 713552, 142714, 285428, 57856, 115712, 231424, 462848, 925696, 1851392, 372784, 745568, 1491136, 2982272, 5964544, 1192988, 2385976, 4771952, 954394, 198788, 397576, 795152, 15934, 31868, 63736, 127472, 254944, 59888, 119776, 239552, 47914, 95828, 191656, 383312, 766624, 1533248, 366496, 732992, 1465984, 2931968, 5863936, 11727872, 23455744, 46911488, 93822976, 187645952, 37529194, 7558388, 15116776, 3233552, 646714, 1293428, 2586856, 5173712, 1347424, 2694848, 5389696, 1779392, 3558784, 7117568, 14235136, 2847272, 5694544, 1138988, 2277976, 4555952, 911194, 1822388, 3644776, 7289552, 1457914, 2915828, 5831656, 11663312, 23326624, 46653248, 9336496, 18672992, 37345984, 74691968, 149383936, 298767872, 597535744, 119571488, 239142976, 478285952, 95657194, 191314388, 382628776, 765257552, 15351514, 37328, 74656, 149312, 298624, 597248, 1194496, 2388992, 4777984, 9555968, 19111936, 38223872, 76447744, 152895488, 3579976, 7159952, 1431994, 2863988, 5727976, 11455952, 2291194, 4582388, 9164776, 18329552, 3665914, 7331828, 14663656, 29327312, 58654624, 11739248, 23478496, 46956992, 93913984, 187827968, 375655936, 751311872, 152623744, 35247488, 7494976, 14989952, 2997994, 5995988, 11991976, 23983952, 4796794, 9593588, 19187176, 38374352, 7674874, 15349748, 3699496, 7398992, 14797984, 29595968, 59191936, 118383872, 236767744, 473535488, 9477976, 18955952, 3791194, 7582388, 15164776, 3329552, 665914, 1331828, 2663656, 5327312, 1654624, 339248, 678496, 1356992, 2713984, 5427968, 1855936, 3711872, 7423744, 14847488, 29694976, 59389952, 11877994, 23755988, 47511976, 9523952, 194794, 389588, 779176, 1558352, 311674, 623348, 1246696, 2493392, 4986784, 9973568, 19947136, 39894272, 79788544, 15957788, 31915576, 63831152, 12766234, 25532468, 5164936, 1329872, 2659744, 5319488, 1638976, 3277952, 655594, 1311188, 2622376, 5244752, 148954, 29798, 59596, 119192, 238384, 476768, 953536, 19772, 39544, 7988, 15976, 31952, 6394, 12788, 25576, 51152, 1234, 2468, 4936, 9872, 19744, 39488, 78976, 157952, 31594, 63188, 126376, 252752, 5554, 1118, 2236, 4472, 8944, 17888, 35776, 71552, 14314, 28628, 57256, 114512, 22924, 45848, 91696, 183392, 366784, 733568, 1467136, 2934272, 5868544, 1173788, 2347576, 4695152, 93934, 187868, 375736, 751472, 152944, 35888, 71776, 143552, 28714, 57428, 114856, 229712, 459424, 918848, 1837696, 3675392, 735784, 1471568, 2943136, 5886272, 11772544, 2354588, 479176, 958352, 191674, 383348, 766696, 1533392, 366784

This sequence is in fact OEIS  A242350:


 A242350

Multiply a(n-1) by 2 and drop all 0's where a(0)=1.                                   


Figure 1 shows a graph of the sequence with a logarithmic scale for the y axis.


Figure 1: permalink

It doesn't matter what the starting point, the sequence will cycle sooner or later. If the starting point is 3 then the cycle begins with 479712 at the 207th term and returns to this number on the 387th term. The largest value reached overall is 582,269,952. Figure 2 shows the graph of the sequence using a logarithmic scale for the y axis.


Figure 2: permalink

The pattern in Figure 2 is very similar to that in Figure 1. The removal of zeroes, when they occur, brings the size of the number down, often drastically. The logarithmic scale gives a false sense of the magnitude of these ups and downs. Figure 3 shows the data without the logarithmic scale for the starting value of 3.


Figure 3: permalink

The same thing can be done with the Fibonacci sequence and again a cycle is reached. The 26th term is 7841 and this number is reached again at the 434th term. I won't list all the terms, just those up to 7841 (permalink):

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 61, 438, 499, 937, 1436, 2373, 389, 2762, 3151, 5913, 964, 6877, 7841, ...

Notice how 233 + 377 = 610 --> 61 and 3151 + 5913 = 9064 --> 964 in the sequence above.

These numbers form OEIS A243063:


 A243063

Numbers generated by a Fibonacci-like sequence in which zeros are suppressed.



Another example is provided by OEIS A256227:

 
 A256227

Naught-y numbers (A011540) that after removing all zeros become zeroless primes (A038618).



The initial members of the sequence (up to 1000) are (permalink):

20, 30, 50, 70, 101, 103, 107, 109, 110, 130, 170, 190, 200, 203, 209, 230, 290, 300, 301, 307, 310, 370, 401, 403, 407, 410, 430, 470, 500, 503, 509, 530, 590, 601, 607, 610, 670, 700, 701, 703, 709, 710, 730, 790, 803, 809, 830, 890, 907, 970

This sequence of course is infinite. Up to one million, there are 45304 terms or about 4.5% of the numbers in the range. That's enough for the time being.