Sunday, 2 November 2025

Palindromic Day 27972

Today is palindromic day 27972 and the last palindromic day of the current millenium. The next palindromic day will occur in the new millenium and will 28082, one hundred and ten days from now.

My first observation is that the digits on either side of the central 9 also add to 9 to give a 9 - 9 - 9 pattern with 9 being the arithmetical digital root as well. This is the first and last time that such a triple pattern will occur in the current millenium. It cannot occur in the next two millenia (2 8 x 8 2 and 2 9 x 9 2) because the digits on either side of the central digit add to 10 and 11 respectively. So already 27972 is rather special. 

27972 is also a member of OEIS A344422: palindromes having more divisors than all smaller palindromes. The table below lists the initial members of this sequence and it can be seen that 27972 has a record 48 divisors.

  number   factorisation        divisors

  1        1                    1
  2        2                    2
  4        2^2                  3
  6        2 * 3                4
  44       2^2 * 11             6
  66       2 * 3 * 11           8
  252      2^2 * 3^2 * 7        18
  2112     2^6 * 3 * 11         28
  2772     2^2 * 3^2 * 7 * 11   36
  6336     2^6 * 3^2 * 11       42
  27972    2^2 * 3^3 * 7 * 37   48
  48384    2^8 * 3^3 * 7        72

27972 is also a member of OEIS A020485: least positive palindromic multiple of \(n\), or 0 if none exists. Here are the multiples for the initial values of \(n\).

  count   n       multiple
  1       1       1
  2       2       1
  3       3       1
  4       4       1
  5       5       1
  6       6       1
  7       7       1
  8       8       1
  9       9       1
  10      0       0
  11      11      1
  12      252     21
  13      494     38
  14      252     18
  15      525     35
  16      272     17
  17      272     16
  18      252     14
  19      171     9
  20      0       0
  21      252     12
  22      22      1
  23      161     7
  24      696     29
  25      525     21
  26      494     19
  27      999     37
  28      252     9
  29      232     8
  30      0       0
  31      434     14
  32      2112    66
  33      33      1
  34      272     8
  35      525     15
  36      252     7
  37      111     3
  38      494     13
  39      585     15
  40      0       0
  41      656     16
  42      252     6
  43      989     23
  44      44      1
  45      585     13
  46      414     9
  47      141     3
  48      2112    44
  49      343     7
  50      0       0
  51      969     19
  52      676     13
  53      212     4
  54      27972   518
  55      55      1
  56      616     11
  57      171     3
  58      232     4
  59      767     13
  60      0       0
  61      26962   442

27972 requires 13 steps to reach the palindrome 4964444694 under the Reverse and Add algorithm. 

27972 is a decagonal or ten-sided number and is the 84th decagonal number and the second non-trivial palindromic decagonal number after 232. See Figure 1 where 232 is shown but not 27972.


Figure 1: source

27972 is a member of OEIS A356854: palindromes that can be written in more than one way as the sum of two distinct palindromic primes. In the case of 27972 we have:

10501 + 17471 = 27972
11311 + 16661 = 27972
11411 + 16561 = 27972
12421 + 15551 = 27972

Tuesday, 28 October 2025

Prime Number Spiral

The number associated with my diurnal age today is a prime number: 27967 and it has the property that it is on the north spoke of a prime number spiral that begins as shown in Figure 1.


Figure 1: source

I thought it might be an interesting challenge for Gemini to write the Python code to generate this spiral up to the largest prime below 40000. To cut a long story short, Gemini failed miserably despite several attempts to improve the code. Grok on the other hand succeeded on its first try although it did time out several times and needed to be reconnected. However, it got the job done and the result is shown in Figure 2 (link to Grok).


Figure 2: code

The formatting is excellent as can be seen in the detail shown in Figure 3 that was taken from Figure 2:


Figure 3: detail from Figure 2

So Gemini proved to be not up to the task despite my persevering with additional prompts whereas Grok succeeded on its first attempt. A lesson learned.

Saturday, 25 October 2025

Prime Factor Fibonacci

A recent number, 27960, associated with my diurnal age has an interesting property if you look at the prime factors more closely:$$27960=2^3 \times 3 \times 5 \times 233$$Let's ignore multiplicity and look at the sum of digits of each distinct prime factor. The 2, 3 and 5 remain the same but 233 becomes 8 and the sequence of prime factors then becomes:$$2, 3, 5, 8$$This is the Fibonacci sequence. How many numbers with four prime factors (ignoring multiplicity) have this property. Well, in the range up to 40000, it turns out that there are 115. These numbers are (permalink):

510, 1020, 1530, 1590, 2040, 2130, 2550, 3060, 3180, 3210, 4080, 4260, 4590, 4770, 5100, 6120, 6360, 6390, 6420, 6990, 7314, 7530, 7650, 7950, 8160, 8520, 8670, 9180, 9540, 9630, 9798, 10200, 10650, 12240, 12720, 12750, 12780, 12840, 12930, 13038, 13770, 13980, 14310, 14628, 14766, 15060, 15090, 15300, 15630, 15900, 16050, 16320, 17040, 17085, 17340, 17466, 18360, 19080, 19170, 19260, 19596, 20400, 20970, 21030, 21300, 21942, 22590, 22950, 23850, 24480, 25440, 25500, 25560, 25680, 25860, 26010, 26076, 26322, 27540, 27960, 28620, 28890, 29256, 29394, 29532, 30120, 30180, 30600, 31260, 31800, 31830, 31950, 32100, 32154, 32637, 32640, 34080, 34530, 34638, 34680, 34932, 34950, 35445, 35511, 36690, 36720, 37650, 38160, 38250, 38340, 38520, 38790, 39114, 39192, 39750

Lets consider the last number in this list: 39750. In this case we have:$$ \begin{align} 39750 &= 2 \times 3 \times 5^3 \times 53 \\ & \rightarrow 2, 3, 5, 8 \end{align}$$If we extend the number of prime factors to five, then only one number satisfies in the range up to 40000:$$ \begin{align}34170 &= 2 \times 3 \times 5 \times 17 \times 67 \\ &\rightarrow 2, 3, 5, 8, 13 \end{align}$$However, there are 160 numbers that satisfy in the range up to one million (permalink). The algorithm actually looks for generalised Fibonacci sequences:$$a,b,c,d,e, \dots \text{ such that } c = a+b, d=b+c, e=c+d \dots$$However, all of the 160 numbers begin with 2. For example, the last of the numbers is 9988520:$$ \begin{align} 998520 &= 2^3 \times 3 \times 5 \times 53 \times 157 \\ &\rightarrow 2, 3, 5, 8, 13 \end{align} $$I tried with six prime factors but without success up to 100 million. Finally I realised that any suitable number must add to 21 and thus be divisible by 3. Such a number can never be a prime factor and so the prime factor sequence must end at 13 and can never progress further.

Sunday, 12 October 2025

A Practical Example of a Convolution

Over the past decade, for some reason, I've chosen to ignore \( \textbf{convolutions} \). Whenever they were mentioned in an OEIS sequence, I simply skipped over the reference. However, I'm now attempting to redress that neglect and to that end I was lucky to find two excellent YouTube videos about convolutions made by 3Blue1Brown (this guy has 7.76 million subscribers and for good reason). The two videos are:

One example of the use of a convolution is that of a weighted die with probabilities of a particular face showing up being given by:
  • p(1) = 0.1
  • p(2) = 0.2
  • p(3) = 0.3
  • p(4) = 0.2
  • p(5) = 0.1
  • p(6) = 0.1
If this die twice is rolled twice, what are the probabilities of throwing a 2, 3, 4, ..., 10, 11, 12? Well, the convolution of the two sequences representing the probabilities of the two dice rolls we tell you. Let's call the sequence A = [0.1, 0.2, 0.3, 0.2, 0.1, 0.1] and the classic way to facilitate the convolution is the so-called "slide and roll". We'll flip A so that it becomes B = [0.1, 0.1, 0.2, 0.3, 0.2, 0.1] and slide B progressively over A. Figure 1 shows the situation for the initial moves.


Figure 1

Of course it would be tedious to have to construct this every time we needed to evaluate a convolution and so Python makes it easier by use of the following code (input in blue, output in red):

A=[0.1,0.2, 0.3, 0.2,0.1,0.1]
result=convolution(A,A)
L=[]
for n in result:
    L.append(numerical_approx(n,digits=2))
print(L)

[0.010, 0.040, 0.10, 0.16, 0.19, 0.18, 0.14, 0.10, 0.050, 0.020, 0.010] 

Reading the output we can see that the probabilities of the various sums are as follows:
  • p(2) = 0.01
  • p(3) = 0.04
  • p(4) = 0.10
  • p(5) = 0.16
  • p(6) = 0.19
  • p(7) = 0.18
  • p(8) = 0,14
  • p(9) = 0.10
  • p(10) = 0.05
  • p(11) = 0.02
  • p(12) = 0.01
Figure 2 shows another view of what's going on. In this case, the various sum are calculated by adding up along the marked diagonals:


Figure 2

This post is simply the first in what I hope will be a series of posts relating to convolutions. As I've already discovered, convolutions linked to Fourier transforms and Laplace transformations so it's a big topic to investigate but at least I've finally made a start.

Thursday, 9 October 2025

Another Prime To Remember

In November of 2024, I created a post titled A Prime To Remember. The prime on that occasion was 27617 and you can read about its properties by following the link. I think it's time to celebrate another prime and that prime is \( \textbf{27947}\). I sometimes struggle to find a single interesting property for the number, on any given day, that is associated with my diurnal age. With 27947 I had no such problem.

First and foremost, it has the property that the sum of its digits, the sum of the squares of its digits and the sum of cubes of its digits are all prime. Thus we have:

  • \(2+7+9+4+7 = 29\) 
  • \(2^2+7^2+9^2+4^2+7^2 = 199\)
  • \(2^3+7^3+9^3+4^3+7^3 = 1487\)
This property affords it membership in OEIS A176179 and there are 322 such numbers in the range up to 40,000. 27947 shares this property with 27617 and so it is included in my blog post A Prime To Remember

27947 also has the property that the absolute differences between successive pairs of digits, and also the first and last digits, are all prime. I discuss these sorts of primes in my blog post titled Fun With Primes and Digit Pairs. Thus we have:
  • \( | 2 - 7 | = 5\)
  • \(| 7 - 9 | = 2\)
  • \(| 9 - 4 | = 5\)
  • \(| 7 - 2 | = 5\)
This property affords it membership in OEIS A087593. This next property relates to the prime producing quadratic polynomial \( (4n-29)^2 + 58 \). This polynomial generates 28 distinct primes in succession from \(n=1\) to \(n=28\). When \(n=49\), the polynomial produces the prime 27947. This property affords it membership of OEIS A320772. See my blog post Another Prime Generating Polynomial.

Still on the subject of primes, 27947 has the property that it is a balanced prime of order 100 and thus a member of OEIS A363168. A prime \(p\) is in this sequence if the sum of the 100 consecutive primes just less than \(p\), plus \(p\), plus the sum of the 100 consecutive primes just greater than \(p\), divided by 201 equals \(p\). In the case of 27947, we have:$$ \begin{align} p_{3050} &= 27947 \\ p_{2950} &= 26891\\ p_{3150} &= 28933\\ \sum_{n=2950}^{3049} p_n &=2742922 \\ \sum_{n=3051}^{3150} p_n &= 2846478 \\ \text{average } &= \frac{ 2742922+27947 + 2846478}{201} \\ &= 27947 \end{align}$$See my blog post titled Varieties of Balanced Primes.

Tuesday, 7 October 2025

Extending Fibonacci-like Numbers

I noticed that in an earlier post titled Consolidating Fibonacci-like Numbers, I looked at numbers like 21347 where we have 2 + 1 = 3 and 3 + 4 = 7 from left to right and even 21101 where 1 + 0 = 1,  0 + 1 = 1 and 1 + 1 = 2 from right to left. In these I only considered additions that resulted in a sums that resulted in a single digit. In this system, a recent diurnal age number (27916) would be ignored and yet 2 + 7 = 9 and 9 + 7 = 16 really does qualify as a Fibonacci-like number.

For this reason I developed an algorithm (permalink) that returns all five digit numbers that follow a Fibonacci-like sequence that will include numbers like 21347 and 27916. Only 28 numbers qualify and these are:

10112, 11235, 12358, 15611, 16713, 17815, 18917, 20224, 21347, 24610, 25712, 26814, 27916, 30336, 31459, 34711, 35813, 36915, 40448, 43710, 44812, 45914, 53811, 54913, 62810, 63912, 72911, 81910

The sequence starts with 10112, 11235, 12358 but then jumps to 15611. What happened to the numbers beginning with 13 and 14? Let's investigate. 

1 + 3 --> 4 and so we have 134
3 + 4 --> 7 and so we have 1347
4 + 7 --> 11 and so we have 134711

However, this is a six digit number and only five digit numbers are being considered. The same holds for the number beginning with 15.

We can reverse the order and reckon from right to left instead of left to right. In this case, we get another 28 numbers. They are (permalink):

10642, 10734, 10826, 10918, 11651, 11743, 11835, 11927, 12752, 12844, 12936, 13761, 13853, 13945, 14862, 14954, 15871, 15963, 16972, 17981, 21101, 42202, 53211, 63303, 74312, 84404, 85321, 95413

If we multiply the digits from left to right (excluding any initial zeroes), we have 15 numbers that satisfy. These are (permalink):

11111, 12248, 14416, 15525, 16636, 17749, 18864, 19981, 21224, 23618, 24832, 31339, 32612, 33927, 42816

If we multiply the digits from right to left (excluding any initial zeroes), we also have 15 numbers that satisfy (permalink):

11111, 12623, 16441, 16824, 18632, 25551, 27933, 32842, 36661, 42212, 49771, 64881, 81991, 84221, 93313

Saturday, 4 October 2025

Solve For X

Here's an interesting little problem. The first time I saw it, I immediately thought Lambert W function and indeed that will yield the two real solutions but there is a simpler way to find one of the solutions. The following is taken from the Mind Your Decisions YouTube channel and I'm including the content here to practise my LaTeX skills and help consolidate what I learnt from the video. Here it is:$$ \begin{align} 3^x &= x^9 \\ (3^{x})^{1/9x} &= (x^{9})^{1/9x} \\ 3^{1/9} &= x^{1/x} \\ ({3^3})^{1/27} &= x^{1/x} \\ 27^{1/27} &= x^{1/x} \\ x &=27 \end{align}$$Quite a neat little trick but there are two solutions so how to we find the other one? That's where the Lambert W function comes in handy.$$ \begin{align} 3^x &= x^9 \\ e^{\ln{3^x}} &= x^9 \\ e^{x \ln{3}} &= x^9 \\ 1 &= \frac{x^9}{e^{x \ln{3}}} \\ 1 &= x^9 e^{-x \ln{3}} \\   (1)^{1/9} &= (x^9 e^{-x \ln{3}})^{1/9} \\ 1 &=xe^{(-x \ln{3})/9} \\ \frac{-\ln{3}}{9} &= x  \Big (\frac{-\ln{3}}{9}\Big ) e^{(-x \ln{3})/9} \\  W \Big (\frac{-\ln{3}}{9} \Big)&= W \Big (x \Big (\frac{-\ln{3}}{9} \Big) e^{(-x \ln{3})/9} \Big ) \\  W \Big (\frac{-\ln{3}}{9} \Big ) &= -(x \ln{3})/9 \\  \frac{-9}{\ln{3} }W \Big (\frac{-\ln{3}}{9} \Big ) &=x  \\ x_1 &= \frac{-9}{\ln{3} }W_{-1} \Big (\frac{-\ln{3}}{9} \Big )  = 27 \\ x_2 &= \frac{-9}{\ln{3} }W_{0} \Big (\frac{-\ln{3}}{9} \Big ) \approx 1.15 \end{align}$$The syntax for evaluation of the above in WolframAlpha uses \( \textbf{productlog} \) instead of W and goes like this:
  • -9/ln 3 * productlog(-1, -ln(3)/9)
  • -9/ln 3 * productlog(0, -ln(3)/9)
Because \( -\ln(3)/9 \approx -0.122 \), this is why we get two solutions. See Figure 1.


Figure 1: graph of \(x=y \, e^y\) and \(x=-\ln(3)/9\)
with intercepts A and B