Friday 26 April 2024

Perimeter Magic Polygons

My previous post was titled Anti-Magic Squares Revisited in which I mentioned heterosquares. Only today however, I came across the concept of a perimeter magic square that is an example of a perimeter magic polygon or PMP to use an acronym. The definition is:

A PMP is defined to be a regular polygon with the consecutive positive integers from 1 to N placed along the perimeter in such a way that the sums of the integers on each side are constant. The order of a polygon refers to the number of integers along each side. The examples in Figures 1, 2 and 3 show a 4th-order triangle, and a 3rd-order square and pentagon. The magic constants are given inside the figures. Source.

Let's look at some perimeter magic triangles to begin with. To quote from Wikipedia:
A magic triangle or perimeter magic triangle is an arrangement of the integers from 1 to \(n\) on the sides of a triangle with the same number of integers on each side, called the order of the triangle, so that the sum of integers on each side is a constant, the magic sum of the triangle. Unlike magic squares, there are different magic sums for magic triangles of the same order. Any magic triangle has a complementary triangle obtained by replacing each integer \(x\) in the triangle with \(1 + n − x\). See Figure 4.


Figure 4

The author of this paper comes up to two sets of formula in which \(C\) is the magic constant,  \(n\) is the order of the polygon and \(k\) is the number of sides. Figures 5 and 6 show these.

Figure 5 shows the formulae for the case of \(n\) even or both \(n\) and \(k\) odd.


Figure 5

Figure 6 shows the formulae for the case of \(n\) is odd and \(k\) is even.


Figure 6

To quote from the article:
With these formulas one can now begin to construct PMPs of any order and number of sides. One word of caution is still in order. There are times when a solution is not possible for certain values of C. The formulas only serve to indicate where solutions may be found, and that there is no need to look elsewhere. However, luck is still with the solver. Based on this author's experience, there are only two cases where solutions cannot be made with values obtained from the formulas. These are 4th-order triangles with \(C \) = 18 and 22, and 3rd-order pentagons with \( C \) = 15 and 18.

By controlling certain of the variables, one can discover some interesting patterns that permit the rapid construction of special PMPs. For example, for 3rd-order PMPs with an odd number of sides, it can be proved that a solution s always possible for the minimum \(C \). And it can be further demonstrated (to the amazement of your friends) that you can produce the solution just as rapidly as it takes to write the \(N\) integers. Rather than present the proof here, two examples will be given, and you can easily note the pattern for yourself.

Figure 7 shows the two examples. 14 is the minimum value of \(C\) for \(n\) = 3 and \(k\) = 5. 19 is the minimum value for \(n\) = 3 and \(k\) = 7.


Figure 7

The pattern in easily perceived once you look at the numbers closely. The article goes further into how to create various PMPs and reference should be made to that for further examples. 

I stumbled upon this topic by way of the number associated with my diurnal age today, 27417. This number is a member of OEIS A135503 for the case where \(n\) = 38.


 A135503

\( \text{a} (n) = \dfrac{n \cdot (n^2 - 1)}{2} \)



The initial members of the sequence are:

0, 0, 3, 12, 30, 60, 105, 168, 252, 360, 495, 660, 858, 1092, 1365, 1680, 2040, 2448, 2907, 3420, 3990, 4620, 5313, 6072, 6900, 7800, 8775, 9828, 10962, 12180, 13485, 14880, 16368, 17952, 19635, 21420, 23310, 25308, 27417, 29640, 31980, 34440

The OEIS comments state that for \(n\) > 2, a(\(n\)) is the maximum value of the magic constant in a perimeter-magic \(n\)-gon of order \(n \). For the case of \(n\) = 38, \(n\) is even and so the formula in Figure 5 applies. Substituting in \(n\) = 38 and \(k\) = 38 does indeed give the maximum value of the magic constant as 27417.

Thursday 25 April 2024

Anti-Magic Squares Revisited

I've written about magic squares before. Here are links to these posts:

In this post, I intend to revisit anti-magic squares and the numbers associated with OEIS A117560:


 A117560

\( \text{a}(n) = \dfrac {n \cdot (n^2-1)}{2} - 1 \)



The OEIS comments state that:
\( \text{a}(n-1) \) is an approximation for the lower bound of the "antimagic constant" of an antimagic square of order \(n\). The antimagic constant here is defined as the least integer in the set of consecutive integers to which the rows, columns and diagonals of the square sum. 
The initial members of this sequence are:

2, 11, 29, 59, 104, 167, 251, 359, 494, 659, 857, 1091, 1364, 1679, 2039, 2447, 2906, 3419, 3989, 4619, 5312, 6071, 6899, 7799, 8774, 9827, 10961, 12179, 13484, 14879, 16367, 17951, 19634, 21419, 23309, 25307, 27416, 29639, 31979, 34439, 37022

27416 is highlighted because it is my diurnal age today and when I made my post about anti-magic squares on July 17th 2018, I was 25307 days old. This number immediately precedes 27416, a gap of 2109 (about 5.77 years in terms of days counted). It will be 2223 days, about 6.09 years, before the next number is reached.

The current number, 27416, relates to an approximation of the lowest integer of a 38 x 38 anti-magic square. Note that it is not necessarily the lowest, it's just an approximation. My July 2018 entry is quite thorough and there's no point repeating all the content there but Figure 1 shows an example of 4 x 4 anti-magic square just to reinforce the property of such a square.

Figure 1: source

The ten sums from a sequence of consecutive numbers, namely 
30, 31, 32, 33, 34, 35, 36, 37, 38, 39. Figure 2 shows a different arrangement. Note that OEIS A117560 gives 29 as the lower bound here.

Figure 2: source

Note that an anti-magic square differs from a so-called heterosquare. As explained in Wolfram Mathworld
A heterosquare is an \(n \times n\) array of the integers from \(1\) to \(n^2\) such that the rows, columns, and diagonals have different sums. By contrast, in a magic square, they have the same sum. There are no heterosquares of order two, but heterosquares of every odd order exist. They can be constructed by placing consecutive integers in a spiral pattern (Fults 1974, Madachy 1979). An antimagic square is a special case of a heterosquare for which the sums of rows, columns, and main diagonals form a sequence of consecutive integers.

Figure 3 shows an example of a 4 x 4 heterosquare:

Figure 3: source

These numbers do not form a sequence of consecutive integers and so they do not form an anti-magic square.

Wednesday 24 April 2024

Visualising Sequences

While playing around with the patterns produced by some sequences, I discovered some interesting patterns. It began with the sequence produced by$$ \text{a}(n)=\sin(n) \cdot e^{-0.001 \cdot n}$$for values of \(n\) from 0 to 2000. See Figure 1 (permalink).


Figure 1

What's interesting is the hexagonal arrangement of the points. The values cannot exceed \( \pm \)1 and the exponential component brings progressive values closer and closer to zero, although at a very slow rate. The pattern becomes rather different once we introduce another element as follows:$$ \text{a}(n)=n \cdot \sin(n) \cdot e^{-0.001 \cdot n}$$for values of \(9n\) from 0 to 4000. See Figure 2 (permalink).


Figure 2

Values range from about - 367 to + 367. Once again, the exponential component eventually dominates and the range of values inexorably decrease. Increasing the exponent of the \(n\) element doesn't really alter the pattern. For example, raising the \(n\) to the fourth power:$$ \text{a}(n)=n^4 \cdot \sin(n) \cdot e^{-0.001 \cdot n}$$for values of \(n\) from 0 to 8000 produces the pattern shown in Figure 3 (permalink).


Figure 4

So nothing profound in this post, just interesting now inputting integral values into a function and plotting the output produces interesting patterns. You can see the same general shape using a program like GeoGebra but the patterns shown do not emerge. See Figure 4.


Figure 4

As can be seen from Figure 4, negative value of \(n\) cause the output values to explode. Of course, most of the sequences that I examine in this blog are integer sequences, the result of integer output from integer input, as found in the OEIS. It's interesting however, from time to time, to examine non-integer output from integer input, as I've done in this post. 

Finally, before we do, consider Figure 5 (permalink) that shows an interesting result for a sequence generated by:$$ \text{a}(n)=n \cdot e^{ \, \sin(x)}$$where the two bounding lines are given by \(y=e \cdot x\) and \(y=1/e \cdot x\).


Figure 5

Friday 19 April 2024

Unleashing the Full Potential of SageMath


My new M1 Macbook Air is already proving its usefulness as I discovered when exploring the properties of the number associated with my diurnal age today, namely 27401. This number has a property that qualifies it for membership in OEIS 
A197816:


 A197816

Smallest composite number \(m\) such that \(m\) and the greatest prime divisor of \(m\) begin with \(n\).



It took me a while to fully understand what this property involved. Once I did, I developed the algorithm in SageMathCell that is shown in Figure 1 (permalink).


Figure 1

However, the operation times out in SageMathCell which is simply an online implementation of SageMath. In the past, when I used the installation of SageMath on my laptop to address this problem, the laptop would generally freeze up and I would have to reboot it. This laptop was a 2013 Macbook Pro that was clearly not capable of handling the calculations. 

The problem with the algorithm is that after a new value of \(m\) is discovered for a given \(n\), the value of \(n\) needs to reset to 4 every time. This needs to be done 299 times and some of the values for \(m\) are quite large. For example, for \(n\)=114 , the value of \(m\) is 114110. Happily my M1 Macbook Air had no difficulty with the calculation and, after 39 seconds, it spat out the numbers for \(n\) up to 299. Here is the output:

102, 203, 36, 410, 50, 603, 70, 801, 970, 1010, 110, 1270, 130, 1490, 1510, 1630, 170, 1810, 190, 20030, 2110, 2230, 230, 2410, 2510, 2630, 2710, 2810, 290, 3070, 310, 32030, 3310, 3470, 3530, 3670, 370, 3830, 3970, 4010, 410, 4210, 430, 4430, 4570, 4610, 470, 4870, 4910, 5030, 51010, 5210, 530, 5410, 5570, 5630, 5710, 5870, 590, 6010, 610, 62030, 6310, 6410, 6530, 6610, 670, 6830, 6910, 7010, 710, 7270, 730, 7430, 7510, 7610, 7730, 7870, 790, 8090, 8110, 8210, 830, 84190, 8530, 8630, 8770, 8810, 890, 9070, 9110, 9290, 9370, 9410, 9530, 9670, 970, 9830, 9910, 10090, 1010, 10210, 1030, 10490, 10510, 10610, 1070, 10870, 1090, 11030, 11170, 11230, 1130, 114110, 11510, 11630, 11710, 11810, 11930, 12010, 12130, 12230, 12310, 12490, 12590, 126010, 1270, 12830, 12910, 13010, 1310, 13210, 133090, 134110, 135130, 13610, 1370, 13810, 1390, 14090, 141070, 14230, 14330, 14470, 14510, 146210, 14710, 14810, 1490, 150130, 1510, 15230, 15310, 15430, 15530, 15670, 1570, 15830, 15970, 16010, 16130, 16210, 1630, 164110, 16570, 16630, 1670, 168110, 16930, 17090, 171070, 17210, 1730, 17410, 17530, 176090, 17770, 17830, 1790, 18010, 1810, 18230, 18310, 18470, 185030, 18610, 18710, 18890, 189110, 19010, 1910, 192070, 1930, 19490, 19510, 196030, 1970, 19870, 1990, 20030, 20110, 20270, 20390, 204070, 20530, 20630, 207070, 20810, 20990, 210010, 2110, 21290, 21310, 21410, 21530, 21610, 21790, 218030, 219110, 22030, 22130, 22210, 2230, 22430, 22510, 22670, 2270, 22810, 2290, 23090, 23110, 232010, 2330, 23410, 23510, 236030, 23710, 23810, 2390, 240010, 2410, 24230, 24370, 24410, 24590, 24670, 24730, 248090, 249070, 25030, 2510, 25210, 25310, 25430, 25510, 256010, 2570, 258010, 25910, 26090, 26170, 26210, 2630, 26470, 26570, 26630, 26710, 26830, 2690, 27070, 2710, 27290, 27310, 27410, 27530, 27670, 2770, 27890, 27910, 28010, 2810, 282010, 2830, 28430, 28510, 28610, 28790, 28870, 28970, 29030, 29170, 29270, 2930, 294010, 29530, 29630, 29710, 298030, 29990

Thus 27410 is the first number that begins with 274 and has a greatest prime divisor (2741) that also begins with 274. As the OEIS comments state: a majority of numbers are divisible by 10. SageMathCell is a great online resource and most of the time, for the calculations I carry out, it is sufficient but it's nice to know that for more protracted calculations, the SageMath installation on my laptop can now be relied upon.

Wednesday 10 April 2024

Dartboard Totals


I've only made one post about darts and dartboards and that was Measuring Dartsmanship on Wednesday 24th of January 2024. In this post, I want to quantify the number the of ways in which a certain total can be achieved using one, two or three darts. To this end, I developed a program in SageMath to do the job and at first glance it worked fine. Figure 1 shows the code using 75 as sample input (permalink).

Figure 1

The output is shown below (there are 194 possible ways of achieving a total of 75):

[[1, 14, 60], [1, 17, 57], [1, 20, 54], [1, 26, 48], [1, 34, 40], [1, 36, 38], [1, 42, 32], [2, 13, 60], [2, 16, 57], [2, 22, 51], [2, 28, 45], [2, 33, 40], [2, 39, 34], [2, 54, 19], [3, 12, 60], [3, 15, 57], [3, 18, 54], [3, 21, 51], [3, 24, 48], [3, 27, 45], [3, 30, 42], [3, 32, 40], [3, 33, 39], [3, 34, 38], [3, 36, 36], [4, 11, 60], [4, 14, 57], [4, 17, 54], [4, 20, 51], [4, 26, 45], [4, 33, 38], [4, 39, 32], [5, 10, 60], [5, 13, 57], [5, 16, 54], [5, 22, 48], [5, 28, 42], [5, 30, 40], [5, 32, 38], [5, 36, 34], [5, 51, 19], [6, 9, 60], [6, 12, 57], [6, 15, 54], [6, 18, 51], [6, 21, 48], [6, 24, 45], [6, 27, 42], [6, 30, 39], [6, 33, 36], [7, 11, 57], [7, 14, 54], [7, 17, 51], [7, 20, 48], [7, 26, 42], [7, 28, 40], [7, 30, 38], [7, 34, 34], [7, 36, 32], [8, 7, 60], [8, 10, 57], [8, 13, 54], [8, 16, 51], [8, 22, 45], [8, 27, 40], [8, 33, 34], [8, 39, 28], [8, 48, 19], [9, 9, 57], [9, 12, 54], [9, 15, 51], [9, 18, 48], [9, 21, 45], [9, 24, 42], [9, 26, 40], [9, 27, 39], [9, 28, 38], [9, 30, 36], [9, 32, 34], [9, 33, 33], [10, 11, 54], [10, 14, 51], [10, 20, 45], [10, 26, 39], [10, 27, 38], [10, 33, 32], [10, 48, 17], [11, 13, 51], [11, 22, 42], [11, 26, 38], [11, 32, 32], [11, 36, 28], [11, 45, 19], [12, 12, 51], [12, 15, 48], [12, 18, 45], [12, 21, 42], [12, 24, 39], [12, 27, 36], [12, 30, 33], [13, 28, 34], [13, 45, 17], [14, 13, 48], [14, 16, 45], [14, 21, 40], [14, 22, 39], [14, 27, 34], [14, 33, 28], [14, 42, 19], [15, 15, 45], [15, 18, 42], [15, 20, 40], [15, 21, 39], [15, 22, 38], [15, 24, 36], [15, 26, 34], [15, 27, 33], [15, 28, 32], [15, 30, 30], [15, 60], [16, 11, 48], [16, 19, 40], [16, 20, 39], [16, 27, 32], [16, 33, 26], [16, 42, 17], [18, 17, 40], [18, 18, 39], [18, 19, 38], [18, 21, 36], [18, 24, 33], [18, 27, 30], [18, 57], [20, 13, 42], [20, 17, 38], [20, 22, 33], [20, 36, 19], [21, 16, 38], [21, 20, 34], [21, 21, 33], [21, 22, 32], [21, 24, 30], [21, 26, 28], [21, 27, 27], [21, 54], [22, 13, 40], [22, 34, 19], [22, 36, 17], [24, 11, 40], [24, 13, 38], [24, 17, 34], [24, 24, 27], [24, 32, 19], [24, 51], [25, 2, 48], [25, 5, 45], [25, 8, 42], [25, 10, 40], [25, 11, 39], [25, 12, 38], [25, 14, 36], [25, 16, 34], [25, 18, 32], [25, 20, 30], [25, 22, 28], [25, 24, 26], [25, 25, 25], [25, 33, 17], [25, 50], [26, 32, 17], [27, 20, 28], [27, 22, 26], [27, 48], [28, 28, 19], [30, 11, 34], [30, 13, 32], [30, 26, 19], [30, 28, 17], [30, 45], [33, 42], [36, 13, 26], [36, 39], [39, 17, 19], [50, 1, 24], [50, 3, 22], [50, 4, 21], [50, 5, 20], [50, 6, 19], [50, 8, 17], [50, 9, 16], [50, 10, 15], [50, 12, 13], [50, 14, 11], [50, 18, 7]]

194

However, using 48 as a total produces an error message as shown in Figure 2.


Figure 2

I don't understand why sum(c) works when the target is 75 but it doesn't work when the target is 48. However, I found that it would work if I made the total 49 and altered the code from "if target = sum(c)" to "if target - 1 = sum(c)". Weird, right. The program works for 23, 29, 31, 35, 37, 41, 43, 44, 46, 47, 49, 52 and does better as the totals get larger. I can't see any obvious pattern to the misfires.

I imported Numpy and used its sum() function but that didn't work either. The same with Pandas. I put Google's Gemini to work on the problem using this prompt:

This SageMath code works for some numbers e.g. 49 but not for other numbers such as 48. When I use 48 as input, I get the following error message: unsupported operand parent(s) for +: 'Integer Ring' and '<class 'list'>'. The error location is sum(c) but I can't determine what the problem is as I don't understand the error message. 

Gemini was confident that it had identified the problem and even proposed a solution but that proved to be nonsense even though appearing plausible at first glance. I'll have to leave it there and if I do discover the source of the problem I'll discuss it here. Link to Airtable record.

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 3 April 2024

On Turning 75

On April 3rd 2024, I turned 75 years old. I like the graphic above that is meant to represent 75%. This translates nicely into years as well, because the maximum span of human life is more or less 100 years and so I've reached 3/4 of that milestone. The only question is how far along the remaining 1/4 will I progress before being cut short.

According to Wolfram Alpha, I have a 50% chance of making it halfway. See Figure 1.


Figure 1

87.5 is the halfway point between 75 and 100. 87.22 is just shy of that. So 50% of my cohort of Australian males will make it to that mark and 50% won't. That's the cold, stark statistic. 25 years is commonly regarded as a generation and so three generations are now behind me. Here is a link to a PDF fact sheet about the number 75 titled Importance Of Number 75 In Mathematics and Other Fields.

Looking at the information about 75 on Numbers Aplenty however, we find more interesting facts. For example, I discovered that it forms a betrothed pair with 48 and that together they form the first such betrothed pair. I'd not heard of this term before but it's defined as follows:

Two numbers \( (m,n) \)  form a betrothed pair if the sum of nontrivial divisors of one number equals the other, i.e., if  \( \sigma(n)-n-1= m\)  and  \(\sigma(m)-m-1 = n\).

The initial pairs are (48, 75), (140, 195), (1050, 1925), (1575, 1648), (2024, 2295), (5775, 6128), (8892, 16587), (9504, 20735), (62744, 75495), (186615, 206504).

The same source informed me that 75 is a repfigit number defined as follows:

Let  \(n\)  be a number with  \(k\)  digits. Let us define a Fibonacci-like sequence using as seeds the digits of  \(n\)  and then at each step adding the last  \(k\)  terms. If  \(n\)  itself appears in the sequence, then it is a repfigit number.

The term repdigit is short for repetitive Fibonacci-like digit and such numbers are also named Keith numbers (Wikipedia link).

For example, 1104 is a repfigit or Keith number because the resulting sequence 1, 1, 0, 4, 6, 11, 21, 42, 80, 154, 297, 573, 1104, contains 1104.

Note that the 6 repfigit numbers with 2 digits are, by definition, fibodiv numbers, too.

The first repfigit numbers are 14, 19, 28, 47, 61, 75, 197, 742, 1104, 1537, 2208, 2580, 3684, 4788, 7385, 7647, 7909, 31331, 34285, 34348, 55604, 62662, 86935, 93993, 120284 

See my blog post titled Fibodiv Numbers to find out what they are about. In the case of 75, a two digit number, we have 7, 5, 12, 17, 29, 46, 75 and thus it qualifies.

75 is also a trimorphic number defined as a number \(n\) such that \(n^3\) ends in \(n\). Thus we have:$$75^3=421875$$The initial trimorphic numbers are: 1, 4, 5, 6, 9, 24, 25, 49, 51, 75, 76, 99, 125, 249, 251, 375, 376, 499, 501, 624, 625, 749, 751, 875, 999. It can be noted that 76 is also trimorphic:$$76^3=438976$$My age in days is 27394 which factorises to 2 x 13697 and thus my life can be divided into exactly two halves, each of length 13697 days. I turned this number of days old on October 3rd 1986. The number 27394 has the property that it is equal to 163 x 167 + 173 where 163, 167 and 173 are successive primes. The initial numbers with this property are:

11, 22, 46, 90, 160, 240, 346, 466, 698, 936, 1188, 1560, 1810, 2074, 2550, 3188, 3666, 4158, 4830, 5262, 5850, 6646, 7484, 8734, 9900, 10510, 11130, 11776, 12444, 14482, 16774, 18086, 19192, 20862, 22656, 23870, 25758, 27394, 29070, 31148, 32590, 34764, 37060, 38220, 39414, 42212

These numbers form part of OEIS A292926.

Saturday 30 March 2024

Very Special Five Digit Numbers

Analysing the number associated with my diurnal age means that since I turned 10000 days old, those numbers have always contained five digits and will continue to do so for the remainder of my life. Today I turned 27391 days old and that number has a very special quality.


What's obvious at first glance is that all the digits are distinct but less obvious is the fact the absolute values of the differences between successive pairs of digits, which are digits themselves, are also distinct and are different to the digits of the number. As there are four such differences between the five digits of the number, this means that all the digits from 1 to 9 make an appearance.$$ \underbrace{|2-7|}_{5} \, \underbrace{|7-3|}_{4} \, \underbrace{|3-9|}_{6} \, \underbrace{|9-1|}_{8}$$Numbers of this sort belong to OEIS A365257:


 A365257

The five digits of a(\(n\)) and their four successive absolute first differences are all distinct.


The OEIS comments state that:
The digit 0 is never present in a(\(n\)) and never appears as a first difference (as this would duplicate in both cases one of the 8 remaining digits involved).

The sequence ends with a(96) = 98274.

The only prime numbers with this property are 39157, 49681, 51869, 53719, 62983, 68749, 68947, 75193, 78259, 89627 and 95287.

The 96 members of this sequence are:

14928, 15829, 17958, 18259, 18694, 18695, 19372, 19375, 19627, 25917, 27391, 27398, 28149, 28749, 28947, 34928, 35917, 37289, 37916, 38926, 39157, 39578, 43829, 45829, 47289, 47916, 49318, 49681, 49687, 51869, 53719, 57391, 57398, 58926, 59318, 59681, 59687, 61973, 61974, 62983, 62985, 67958, 68149, 68749, 68947, 69157, 69578, 71952, 71953, 72691, 72698, 74619, 74982, 74986, 75193, 75196, 76859, 78259, 78694, 78695, 81394, 81395, 81539, 82941, 82943, 85179, 85629, 85971, 85976, 86749, 87269, 87593, 87596, 89372, 89375, 89627, 91647, 91735, 92658, 92834, 92851, 92854, 93518, 94182, 94186, 94768, 94782, 94786, 95281, 95287, 95867, 96278, 96815, 97158, 98273, 98274

As can be seen, I'm due to experience another such number in a week from today when I reach 27398 days old. My forthcoming 75th birthday, when I am 27394 days old, thus falls between these two special five digit numbers. 

A Truly Incredible Fact About The Number 37

It was this video from the YouTube channel Veritasium that made me aware of the considerable interest attached to the number 37.


I then found this post from a blogger, Chris Grossack, to be especially helpful in explaining the following:
37 is the median value for the second prime factor of an integer; thus the probability that the second prime factor of an integer chosen at random is smaller than 37 is approximately 50%.
He also uses SageMath for his calculations which was an added bonus. Here is the permalink to the calculation to determine the median using the first 100,000 numbers. The output is shown in Figure 1.


Figure 1

The actual proof is summarised in the information contained in Figure 2 which is more than I can comprehend, but I'll include it here:


Figure 2

The blogger uses the formulae shown in Figure 2 to once again show that 37 is the median value. Here is the permalink and the output is shown in Figure 3.


Figure 3

Of course this is not 37's only claim to fame. Wikipedia has an entry for the number 37 and some of the interesting facts contained in that article include a 3 x 3 magic square with 37 at its centre. See Figure 4.

Figure 4

Its magic constant is 37 x 3 = 111, where 3 and 37 are the first and third base-ten unique primes (the second such prime is 11). I wasn't familiar with the notion of a unique prime and so I'll include a definition from the Wikipedia article here:
A prime \(p\) (where \(p\) ≠ 2, 5 when working in base 10) is called unique if there is no other prime \(q\) such that the period length of the decimal expansion of its reciprocal, 1/\(p\), is equal to the period length of the reciprocal of \(q\), 1/\(q\). For example, 3 is the only prime with period 1, 11 is the only prime with period 2, 37 is the only prime with period 3, 101 is the only prime with period 4, so they are unique primes. The next larger unique prime is 9091 with period 10, though the next larger period is 9 (its prime being 333667). Unique primes were described by Samuel Yates in 1980.
I've written about 37 extensively as well in a post titled Star Numbers from the 7th of June 2019. There is a website dedicated to the number 37. It's mentioned by its creator in the YouTube video earlier but, as he himself admits, it hasn't been updated in very many years. However, it still contains a wealth of information.

For example, the site describes a method of determining if a number is divisible by 37. This is the method:
  • Divide the number up in groups of three digits, starting from the right.
    (The left-most group may not have three digits.)
  • Add the groups together.
  • Repeat steps 1 and 2 if the result is still longer than three digits, repeat steps 1 and 2.
  • Examine the final three-digit (or smaller) number
The original number is divisible by 37 if and only if this three-digit number is.

I often take note of car number plates here in Jakarta. These are typically of the form B-xxxx where xxxx is a four digit number. It's easy to determine if the four digit number is divisible by 3 because the first digit is simply added to the remaining three. Using leading zeros, the multiples of 37 are:

037, 074, 111, 148, 185, 222, 259, 296, 333, 370, 407, 444, 481, 518, 555, 592, 629, 666, 703, 740, 777, 814, 851, 888, 925, 962, 999

The repeated digit numbers (111 to 999) are a dead given away but the others are not two difficult to identify. Let's consider a number plate like B-1258. The 1258 --> 1 + 258 = 259 = 7 x 37. In this case, the 7 can be divided in to reveal the 37 rather than dealing with division by 37. There is no limit to what can be said about the number 37 but at least in this post and my earlier post of star numbers I've made a start.

Thursday 28 March 2024

Conway's Game of Life Records

Since the 15th February 2024 I've been tracking the number of generations required for the number associated with my diurnal age to reach stability under the rules of Conway's Game of Life. On that date, I created a post titled Diurnal Age Meets Conway's Game Of Life that explained the manner in which this number was arrived at. 

Up until today, the record of around 1190 generations was held by 27373 on the 13th March 2024. At that date, no other number had surpassed 1000 generations. Today however, the number associated with my diurnal age, 27388, exceeded the previous record by an impressive margin. This number required slightly less than 1700 generations to reach stability.

Early in the evolution two gliders were created so these do not appear in the screenshot shown in Figure 1 because by the time stability was reached they were far off screen.


Figure 1: using https://playgameoflife.com/

The path of the gliders can be seen in this alternative view shown in Figure 2 where oscillators appear in black and still life shapes appear as white, both against a background of orange cells that were active prior to stability.


Figure 2: using https://conwaylife.com/

Here's a video of the action:


So the record has been set and it remains to be seen when it will be surpassed but this post formally notes the record and if and when it is exceeded I'll add an addendum.

It's interesting what a difference a single cell that is turned on or off can make. For example, 27389 is identical to 27388 except for one cell that is turned off and thus makes the 8 into a 9. Under Conway's Game of Life rules, it terminates in 142 generations and leaves only two blocks. It's nice how the glider collides with a third block so that the two annihilate each other. Here is a video of the action:


ADDENDUM, Sunday April 14th 2024

27402 stabilises after about 2070 generations under Conway's Game of Life rules to six gliders and an assortment of still lifes and oscillators. This sets the record so far for number of generations. The previous record was held by 27388 with about 1700 generations.