Showing posts with label add. Show all posts
Showing posts with label add. Show all posts

Wednesday, 14 June 2023

The RATS Sequence Revisited

It was on Saturday, 26th September 2020, that I first wrote about the RATS sequence, the acronym standing for Reverse --> Add --> Then Sort. On that occasion I was looking at the number 26109 that is a member of OEIS A114613:


A114613

Starting numbers for which the RATS sequence has eventual period 3.      


Yesterday the number associated with my diurnal age, 27099, is the next member of that sequence. The sequence runs (permalink):

20169, 20709, 21159, 22149, 23139, 24129, 25119, 26109, 27099, 28089, 29079, 30159, 30168, 30708, 30789, 31149, 31158, 31779, 32139, 32148, 32769, 33129, 33138, 33759, 34119, 34128, 34749, 35109, 35118, 35739, 36108, 36729, 37098, 37719, 38088, 38709, 39078, 39699, ...

As can be seen, the members of this sequence are few and far between. Up to 40,000, there are only 38 terms. In the case of 27099 the progression is:

27099, 111267, 337788, 1122255, 4446666, 1111113, 2222244, 4446666

There are sequences with different periods but for most numbers the progression is infinite. See Table 1:


Table 1

The original post contains more information that I won't repeat here. Using my diurnal age today (27100) as an example, we see the divergent period-2 pattern emerging, with the red showing the progression of this period-2 pattern (permalink).

27100
22277
49999
134999
113344
555566
1111222
2333333
5566666
11222333
44444455
88889999
178888888
156777779
113344555
666677888
1444555555
167999
116677
238889
1122277
4448888
12333337
55666688
133333444
556667777
1233334444
5566667777
12333334444
55666667777
123333334444
556666667777
1233333334444
5566666667777
12333333334444
55666666667777
123333333334444
556666666667777
1233333333334444
5566666666667777

It won't be until I turn 28089 days old that I'll meet this sequence again. The Wolfram Demonstration Project also features the RATS sequence and displays the progression of terms up till the start of the period-2 pattern. See Table 2.


Table 2

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.