Thursday 2 May 2024

Divisibility Sequences

It's easy to miss. The square numbers are 1, 4, 9, 16, 25, 36, 49 and so on but it's not obvious that the consecutive integers 27423, 27424 and 27425 are divisible by consecutive square numbers. Thus we have:$$ \begin{align} 27423 &= 3^2 \cdot 11 \cdot 277 \text{ divisible by }9=3^2\\27424 &= 2^5 \cdot 857 \text{ divisible by }16=4^2\\27425 &= 5^2 \cdot 1097 \text{ divisible by }25=5^2 \end{align}$$I only noticed this fact because my diurnal age today is 27423 and this number is a member of OEIS A178919:


 A178919

Smallest of three consecutive integers divisible respectively by three consecutive squares greater than 1.



Membership of this sequence does not come easy and can be seen in the list of its initial members (permalink):

2223, 5823, 9423, 13023, 16623, 20223, 23823, 27423, 31023, 32975, 34623, 38223, 41823, 45423, 49023, 52623, 56223, 59823, 63423, 67023, 70623, 74223, 77075, 77823, 81423, 85023, 88623, 92223, 95823, 99423, 103023, 106623, 110223

Not surprisingly membership in the equivalent sequence of two consecutive integers divisible by two consecutive squares is a lot easier. This sequence is OEIS A178918. The natural question to ask is whether there are groups of four consecutive integers divisible by four consecutive squares. Testing up in the range up to ten million, we find no such groups. However, they may well exist further out.

What about cubes? Can we find groups of three consecutive integers that are divisible by three consecutive cubes greater than 1. Indeed we can and, up one million, the sequence of the smallest members of these trios is (permalink):

106623, 322623, 538623, 754623, 970623 (not listed in the OEIS)

Let's look at the first member of the sequence where we find:$$\begin{align} 106623 &= 3^3 \cdot 11 \cdot 359 \text{ divisible by } 27 =3^3\\106624 &= 2^7 \cdot 7^2 \cdot 17 \text{ divisible by }64 =4^3\\106625 &= 5^3 \cdot 853 \text{ divisible by }125 =5^3 \end{align}$$What's interesting about sequences like this is that the numbers derive their membership via the groups to which they belong. For convenience, as in the case of OEIS A178919, only the first number in the group is listed. It is the relationship between the numbers in the group that are important. In the case of OEIS A178919 the numbers form a group of three that are consecutive and divisible by consecutive squares. Thus we have in the case of 27423:$$ \text{consecutive integers -->}\\ \frac{27423}{9} \, \frac{27424}{16} \, \frac{27425}{25} \\ \text{consecutive squares -->} $$or in the case of 106623:$$ \text{consecutive integers -->}\\ \frac{106623}{27} \, \frac{106624}{64} \, \frac{106625}{125} \\ \text{consecutive cubes -->} $$It would be interesting to explore divisibility using criteria other than divisibility by consecutive squares or cubes. What about divisibility of three consecutive integers by three consecutive fibonacci numbers (0, 1, 1, 2, 3, 5, 8, ...)? Well, if we ignore 0 and 1 and start with 2, it turns out that a great many groups of three qualify, most of which are divisible by 2, 3 and 5. The first of these begin with 8:$$ \begin{align} 8 &= 2^3 \text{ divisible by fibonacci number }2\\9 &= 3^2 \text{ divisible by fibonacci number } 3\\10 &= 2 \cdot 5 \text{ divisible by fibonacci number } 5 \end{align}$$There are 4417 such groups of three in the range up to 100,000, so they very common. If we exclude 2, 3 and 5 and begin instead with 8, then the groupings of three become far less common (only 60 in the range up 100,000). The first of these begins with 376 (permalink):$$ \begin{align} 376 &= 2^3 \cdot 47 \text{ divisible by fibonacci number } 8\\377 &= 13 \cdot 29 \text{ divisible by fibonacci number }13\\378 &= 2 \cdot 3^3 \cdot 7 \text{ divisible by fibonacci number } 21 \end{align}$$This is clearly a topic worthy of further research.

Monday 29 April 2024

Another Record in Conway's Game of Life

I've written about Conway's Game of Life in numerous posts but specifically in Conway's Game of Life Records I began to track record number of generations using polyominoes in the shape of my diurnal age as the starting points. I began that post by saying:

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.

 I fairly quickly had to add two addendums to the post and here they are:

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.

ADDENDUM, Sunday April 28th 2024

Only two weeks since my last addendum and 27419 sets a new record by a significant margin. The new number of generations is about 3745 and Figure 3 shows the final configuration with the paths of the numerous gliders clearly visible.

The latest record marked an impressive increase in the number of generations required to achieve stability. The purpose of this post is to show the progression more clearly and to include an animation of the progression for 27419. See below.


I've been dutifully recording the number of generations required to reach stability since the 15th of February 2024. Figure 1 shows a screenshot of the final configuration for 27419.


Figure 1

I'd like to think I'm the only person on the planet to have ever thought of pursuing this particular activity, at least on a consistent basis. Maybe. In any case, I'll continue the pursuit and happily record, in an addendum to this post, when the current record is broken.

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.