Showing posts with label number of the beast. Show all posts
Showing posts with label number of the beast. Show all posts

Saturday, 6 April 2024

Primes and Nines + Primes to Apocalyptic Primes

My diurnal age today is 27397 and this number is prime, marking the end of a 30 day drought of primes according to this daily reckoning. The previous prime, 27367, has a property that marks it for membership in OEIS A124596: primes \(p\) such that \(q-p = 30\), where \(q\) is the next prime after \(p\). So here we are at \(q=27397\).

Now this current prime is rather special because it has a property that marks it for membership in OEIS A215421:


 A215421

Primes that remain prime when a single digit 9 is inserted between any two consecutive digits or as the leading or trailing digit.


This means that 927397, 297397, 279397, 273997, 273997 and 273979 are all prime. There is a redundancy in this list of course between 273997 and 273997. Up to 40000, the primes in this sequence are:

7, 19, 37, 41, 199, 239, 311, 587, 661, 941, 967, 1009, 1997, 4993, 4999, 5393, 5651, 6911, 9109, 9397, 9679, 9829, 19417, 20233, 22549, 27397, 29389, 31387, 39989

Clearly, it's been a long while since I experienced a prime with this property and it will be a long while before I experience another. However, what this post is mainly about is how Google's Gemini assisted me in creating an algorithm to generate the initial numbers in this sequence.

I asked Gemini the following question (link):
Can you create a Python program that will generate as output the digit 9 inserted only once, but successively, between every digit of a number that is input. The insertion should take place at the beginning of the number and at the end of the number as well as the between all the digits. For example, if the number 783 was the input then the output would be 9783, 7983, 7893 and 7839.

To which the response was:

Absolutely, here's a Python program that achieves what you described:

This code defines a function insert_digit that takes an integer as input. Here's how it works:

This was very helpful and I was quickly able to incorporate the code into SageMathCell and generate the sequence (permalink). Without the comments, the Python code boils down to this:

def insert_digit(number):
    number_str = str(number)
    inserted_numbers = []
    for i in range(len(number_str) + 1):
        inserted_numbers.append("".join([number_str[:i], "9", number_str[i:]]))
    return inserted_numbers

I find manipulating strings in Python to be quite tedious so I welcomed Gemini doing it for me and the resulting code is straightforward and easy to understand. It can be modified of course using the digits "1", "3" and "7". This generates three new sequences:


 A069246

Primes which yield a prime whenever a 1 is inserted anywhere in them (including at the beginning or end).



Up to 40000, the initial members of this sequence are (permalink):

3, 7, 13, 31, 103, 109, 151, 181, 193, 367, 571, 601, 613, 811, 1117, 1831, 4519, 6871, 11119, 11317, 11467, 13171, 16141, 17167, 18211, 18457, 27241, 38917


A215419





Primes that remain prime when a single digit 3 is inserted between any two consecutive digits or as the leading or trailing digit.

Up to 40000, the initial members of this sequence are (permalink):

7, 11, 17, 31, 37, 73, 271, 331, 359, 373, 673, 733, 1033, 2297, 3119, 3461, 3923, 5323, 5381, 5419, 6073, 6353, 9103, 9887, 18289, 23549, 25349, 31333, 32933, 33349, 35747, 37339, 37361, 37489


 A215420

Primes that remain prime when a single digit 7 is inserted between any two consecutive digits or as the leading or trailing digit.



Up to 40000, the initial members of this sequence are (permalink):

3, 19, 97, 433, 487, 541, 691, 757, 853, 1471, 2617, 2953, 4507, 6481, 7351, 7417, 8317, 13177, 31957

Once I spotted the 27241 in OEIS A069246 it occurred to me that I'd probably covered the insertion of 1's in an earlier post and it turned out that indeed I had. On November 2nd 2023, I created a post titled "The Everyone Prime". In that post, I deal with the insertion of 3's and 7's as well but for some reason neglected to mention the insertion of 9's. 

I made 62 posts since that November post so it's not surprising that I sometimes repeat myself but, even though there's redundancy in the two posts, there is some new material including OEIS A215421 (the insertion of 9's) and the use of Google' Gemini to generate Python code.

As a means of adding additional new content to this post, let's use the previous Python code and try inserting the number of the beast, 666, at the beginning of a prime or between the digits of the prime to create a new prime that might called an apocalyptic prime. We'll only look at starting primes in the range from 1 to 999 so that our resulting apocalyptic primes are less than one million.

The following primes (shown with repetition) produce one, two or three apocalyptic primes (runs of three are marked in bold):

11, 17, 29, 29, 43, 43, 53, 53, 83, 97, 97, 101, 101, 103, 103, 109, 109, 109, 113, 113, 127, 131, 139, 149, 157, 167, 167, 167, 173, 179, 191, 191, 193, 193, 211, 223, 229, 229, 233, 233, 241, 241, 251, 263, 263, 269, 271, 277, 277, 281, 283, 293, 307, 311, 313, 331, 337, 347, 349, 353, 353, 383, 397, 397, 401, 419, 421, 431, 433, 439, 449, 461, 467, 487, 499, 503, 541, 541, 557, 577, 587, 593, 593, 599, 599, 607, 607, 619, 643, 643, 647, 647, 683, 683, 701, 709, 709, 727, 733, 739, 751, 751, 757, 769, 773, 787, 811, 821, 823, 823, 823, 827, 829, 829, 829, 839, 853, 857, 883, 883, 887, 919, 929, 929, 937, 937, 941, 947, 953, 977, 983

Here are the 125 apocalyptic primes that they produce (permalink).

16661, 26669, 46663, 56663, 66617, 66629, 66643, 66653, 66683, 66697, 96667, 106661, 106663, 106669, 116663, 146669, 166601, 166603, 166609, 166613, 166627, 166631, 166657, 166667, 166679, 166693, 196661, 196663, 216661, 226663, 226669, 246661, 256661, 266633, 266641, 266663, 266671, 266677, 266681, 266683, 296663, 316661, 316663, 336667, 346667, 346669, 356663, 366607, 366631, 366683, 366697, 396667, 406661, 426661, 466619, 466649, 486667, 496669, 506663, 546661, 566677, 566693, 586667, 596663, 596669, 616669, 666109, 666139, 666167, 666173, 666191, 666229, 666233, 666269, 666277, 666353, 666431, 666433, 666439, 666461, 666467, 666541, 666557, 666599, 666607, 666643, 666647, 666683, 666727, 666733, 666751, 666769, 666773, 666811, 666821, 666823, 666829, 666857, 666929, 666937, 666983, 706661, 706669, 756667, 766609, 766639, 766651, 766687, 826663, 826667, 826669, 866623, 866629, 866639, 866653, 866683, 886663, 886667, 926669, 936667, 946661, 946667, 966619, 966653, 966677

It can be noted that 607, 643 and 683 produce apocalyptic primes that contain four consecutive sixes, namely 666607, 666643, 666647 and 666683 respectively. Of course, these are not the only apocalyptic primes because those above were generated using initial primes. If we begin with either composite or prime numbers between 1 and 999, then 203 apocalyptic primes are generated (permalink). So 78 composite numbers will also generate these types of primes, beginning with 1 --> 6661 and ending with 979 --> 976669 (neither 1 nor 979 = 11 x 89 are prime). The algorithm is easily modified to accommodate other digit sequences like 777 (permalink).

Wednesday, 24 May 2023

That Number Again

The number associated with my diurnal age today, 27079, is a member of OEIS  A133562:


  A133562

Numbers which are the sum of the squares of seven consecutive primes.   
  


In the case of 27079, the primes are as shown below (permalink):$$47^2+ 53^2+ 59^2+ 61^2+ 67^2 +71^2+ 73^2 = 27079$$However, it is the very first term in this sequence that is most interesting as it is the number 666:$$2^2+3^2+5^2+7^2+11^2+13^2+17^2=666$$It is the only even number in the sequence because it includes the even square \(4=2^2\). I naively thought that it might be possible to arrange these squares to form an \(18 \times 37\) rectangle but I was swiftly disabused of this notion when I recalled a post called Squaring the Square that I'd made on January 29th 2021.

In this post, I note that the smallest square that can be constructed of smaller squares of unequal size requires 21 squares and has a side of 112 units. The smallest rectangle than can be constructed from smaller squares of unequal size requires 9 squares and has dimensions of \(32 \times 33 \) units. Clearly then a rectangle of dimensions \(18 \times 37\) cannot be constructed from only seven unequal squares.

However, I did find a decomposition of the square of side 666 into 26 smaller squares of unequal size. These squares have the following sides: 2, 3, 8, 33, 36, 55, 65, 69, 89, 90, 97, 102, 105, 107, 109, 111, 120, 129, 132, 171, 175, 185, 186, 220, 230, 261. See Figure 1.


Figure 1: decomposition of square of side 666 (source)

This square of side 666 units has an area of 443556 square units. So just an interesting little diversion with the result that:$$2^2+ 3^2 + \dots + 230^2+ 261^2 = 666^2$$

Saturday, 5 February 2022

Apocalyptic Numbers


X-Men: Apocalypse (2016)

Numbers Aplenty has to say about apocalyptic numbers:

A number of the form \(2^n\) is called apocalyptic if its digits contain "666" as a substring. The smallest apocalyptic number is \(2^{157}\), which is equal to:$$182687704\underline{666}362864775460604089535377456991567872$$while \(2^{220}\) is the smallest apocalyptic number which contains two 666 groups, being equal to:$$ {\tiny 168499\underline{66666}969149871\underline{666}88442938726917102321526408785780068975640576} $$The smallest power of 2 with 3 groups is \(2^{931}\).

A number \(n\) such that \(2^n\) is apocalyptic is called an apocalyptic power or apocalyptic exponent.

Between \(1\) and \(3 \times 10^6\) there are 3715 numbers which are non-apocalyptic exponents, the largest being 29784. In other words, it is highly probable that \(2^n\) for \(n \ge 29785\) is an apocalyptic number.

Probably there are only 8 numbers, namely 2666, 3666, 5666, 6660, 6665, 6669, 11666, 26667 which contains 666 among their digits but are not apocalyptic exponents.

The first apocalyptic exponents are 157, 192, 218, 220, 222, 224, 226, 243, 245, 247, 251, 278, 285, 286, 287, 312, 355, 361, 366, 382, 384, 390, 394, 411, 434, 443, 478, 497, 499, 506, ...

Here is a link to the first 1000 apocalyptic exponents. As the numbers get larger, the frequency of numbers being non-apocalyptic exponents decreases so that, after 29874, the frequency is (probably) zero. For example, in the range from 20000 to 30000, there are only the following non-apocalyptic exponents:

20271, 20300, 20509, 20644, 20710, 21077, 21600, 21602, 22447, 22734, 23097, 23253, 24422, 24441, 25026, 25357, 25896, 26051, 26667, 29784

Why this interest in apocalyptic numbers? Well, in my diurnal age count, I've entered what might be termed an "apocalyptic phase". I'm currently 26606 days old and heading toward 26666 (the latter occurs a day before my 73rd birthday). Interestingly, as can be seen in the range of numbers above, 26667 is the second last non-apocalyptic exponent.

Numbers Aplenty also shows the smallest 3 × 3 magic square made of consecutive apocalyptic numbers. See Figure 1.

Figure 1

The apocalyptic powers comprise OEIS A007356:


 A007356

Apocalyptic powers: \(2^n\) contains \(666\).                           
                                

Finally, let's not forget that:
Georg Cantor was born on the 3rd March 1845 in St Petersburg, Russia, and died on the 6th January 1918 in Halle, Germany. At the time of this death, he was 72 years 10 months and 3 days old or 72.85 years of age which is equivalent to 26606 days.

Georg Cantor

This is the exact age that I am today.