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

Primes Within Transcendental Numbers

One of the properties of the number associated with my diurnal age today, 27943, is that it is a prime formed by merging five successive digits in the decimal expansion of \(e \). Primes with this property form OEIS A104846. This got me thinking about whether all possible primes could be expressed by merging successive digits in the decimal expansions of all transcendental numbers like \(e\) and \( \pi \).  

However, as Grok explained:

No, it cannot be proven that the decimal expansions of transcendental numbers like \( \pi \) or \(e\) contain representations of all prime numbers through progressive concatenations of consecutive digits. This interpretation hinges on whether every possible finite sequence of digits—including the decimal representations of all primes—appears as a substring somewhere in their infinite, non-repeating expansions. While this would be true if \( \pi \) and \(e\) are normal numbers (where every digit sequence of length \(k\) appears with equal frequency \(1/10^k\) in the limit), the normality of \( \pi \) and \(e\) remains an open problem in mathematics. 

If numbers like \( \pi \) and \(e\) could be proven to be normal then not only would every prime occur but it would occur an infinite number of times. It's interesting to look at 27943 and see how many times it appears in the first million digits of \(e\). Here are the initial positions for the "2" (permalink):

166, 46606, 217029, 234391, 248347, 258504, 483659, 832027, 941722

For \( \pi \), it takes a while before the first occurrence but afterwards the occurrences of 27943 are more frequent (permalink):

94943, 146738, 216793, 253032, 283291, 290571, 302660, 350882, 358637, 520562, 632389, 661691, 715324, 805161, 843112, 890626

I wondered if there was any difference between algebraic numbers like \( \phi \), the golden ratio, and transcendental numbers in regards to being able to represent all primes as concatenations of successive digits. Here's was Grok's response:

No, it cannot be proven that the decimal expansions of algebraic irrational numbers like the golden ratio (\( \phi  \approx 1.6180339887 \dots \)) contain representations of all prime numbers through progressive concatenations of consecutive digits, for essentially the same reasons as with transcendentals like \( \pi \) and \(e\). Their normality in base 10 remains unproven. 

Just as with Ï€ and e, the golden ratio's decimal expansion is infinite and non-repeating (since it's irrational), but this doesn't guarantee it contains all sequences. Empirical checks of millions of digits suggest randomness consistent with normality, but no proof exists—not even that all digits 0-9 appear infinitely often. It's widely conjectured that φ (a quadratic irrational algebraic number) is normal in base 10, mirroring beliefs about Ï€ and e. Proving this would be a major result in number theory.

There's a specific conjecture (dating back to Borel in 1909, refined later) that every irrational algebraic number is absolutely normal (normal in every integer base \(\geq 2)\). This includes \( \phi, \sqrt{2}, \sqrt{3} \), and others. No counterexamples exist, but crucially, no irrational algebraic has ever been proven normal in any base. In contrast, for transcendentals, normality isn't conjectured for all—only for certain "natural" ones like \( \phi \) and \(e\)—while many non-normal transcendentals are known (e.g., Liouville numbers designed to lack certain digits). 

Proven examples: We have constructed transcendentals proven to be normal, such as Champernowne's constant ( 0.123456789101112 ...)  or the Copeland–ErdÅ‘s constant (formed by concatenating primes: 0.235711131719... ). These do contain every finite digit sequence infinitely often, including all primes. No such proven-normal algebraic irrationals exist, partly because algebraics satisfy polynomial equations, which might impose subtle constraints on their expansions (though the conjecture suggests not). 

In summary, algebraic irrationals like \( \phi \) aren't fundamentally "different" in the sense that the core question—whether all primes appear as substrings—remains unproven and conjectured true, just like for \( \phi\) and \(e\). The main distinction lies in the broader landscape: Algebraics have a stronger universal conjecture without exceptions or proven cases, while transcendentals show a mix of proven normal and non-normal examples. If the conjectures hold, then yes, \( \phi \)'s expansion would contain all primes, but we can't prove it yet.

So at what positions does the prime 27943 appear in the decimal expansion of \( \phi \). Here are the locations (permalink):

33280, 127164, 129935, 529433, 597796, 795399, 971620

Wednesday, 1 October 2025

Which is Larger?


The question was posed in a YouTube video as to which was larger: \(3.14^{\pi}\) or \( \pi^{3.14}\) ? The use of a calculator was not allowed. The solution provided in the video is interesting.$$ \begin{align} &3.14^{\pi} \text{ versus } \pi^{3.14} \\ &\text{raise each to the } 1/3.14 \text{ power} \\ &3.14^{\pi /3.14} \text{ versus } \pi^{3.14/3.14} \\ &3.14^{\pi/3.14} \text{ versus } \pi  \\ & \text{raise each to the } 1/ \pi \text{ power}  \\ &3.14^{\pi/(3.14 \pi)} \text{ versus } \pi ^{1/\pi} \\   &3.14^{1/3.14} \text{ versus } \pi ^{1/\pi} \end{align} $$Now consider the function \(y=x^{1/x}\) which we will modify as follows:$$ \begin{align} y &=x^{1/x} \\ &= e^{\ln{x^{1/x}}} \\ &=e^{1/x \ln{x}} \end{align}$$Let's find its first derivative in order to determine stationary values:$$ \begin{align} \frac{dy}{dx} &=e^{1/x \ln{x}} \frac{d}{dx} (1/x \ln{x})\\ &= \frac{e^{1/x \ln{x}}}{x^2}(1-\ln{x})  \end{align} $$the numerator and denominator on the left are always positive so it comes down to:$$ \begin{align} 1-\ln{x} = 0  \text{ when } x=e \\  \\ \text{if } x<e, dy/dx > 0 \text{ and if } x>e, dy/dx < 0 \end{align}$$Thus there is a maximum turning point at \(x=e\) and since, after this point, \(y\) decreases as \(x\) increases, we must have:$$3.14^{1/3.14} > \pi^{1/\pi} \text{ since } 3.14 < \pi$$This in turn means that by reversing our original transformation, we have:$$3.14^{\pi} > \pi^{3.14}$$Figure 1 shows what the graph of \(y=x^{1/x}\) look like.


Figure 1: note the gradual descent as \(x\) gets larger

The approximate values of our two expressions are as follows:$$ \begin{align} 3.14^{\pi}&\approx 36.4041195357888 \\ \pi^{3.14} &\approx 36.3957438848941 \end{align}$$The solution to this problem also settles the more general issues surrounding when \(a^b\) is larger or smaller than \(b^a\) with \(a,b>1\). Let's consider the problem of:$$a^b \text{ versus } b^a \text{ for the particular case of }2024^{2025} \text{ versus } 2025^{2004}$$We know from earlier that this comparison reduces to:$$ \begin{align} &a^{1/a} \text{ versus } b^{1/b} \text{ or } 2024^{1/2024} \text{ versus } 2025^{1/2005} \\  &\text{and if }a>e, b>e \text{ and } a<b \text{ then:} \\ &\text{because } 2024 < 2025 \text{ we have:}\\ &2024^{2025} > 2025^{2004} \end{align} $$ However, what about:$$ \phi^{1.618} \text{ versus } 1.618^{\phi}$$Here the problem reduces to:$$\phi^{1/\phi} \text{ versus } 1.618^{1/1.618}$$Here \(\phi<e\) and \(1.618<e\) and \(1.618 < \phi\), so:$$ 1.618^{1/1.618} < \phi ^{1/\phi} \text{ and } 1.618^{\phi}<\phi^{1.618}$$Double checking we find that:$$ \begin{align} 1.618^{\phi} \approx 2.17838352536880\\ \phi^{1.618} \approx 2.17842193783803 \end{align}$$If the values of \(a\) and \(b\) fall on either side of \(e\) then the previous methods don't work. I'll leave this problem for another post possibly as I've spent enough time on this.

Tuesday, 23 September 2025

Obscure Difference of Two Squares

 Here's an interesting problem that appeared in this YouTube video:

Find the values of \(a, b \in \mathbb{N}\) such \(a^b-b=77\).

With two unknowns and only one equation, the problem seems daunting but the factorisation of 77 and the fact that the values of \(a\) and \(b\) are restricted to natural numbers will be enough to solve the problem. However, the solution that the video describes hinges on the use of a difference of two squares and this is not at all obvious. Let's begin:$$ \begin{align} a^b-b &= 77 \\ (a^{b/2})^2-(\sqrt{b})^2 &= 77 \\ (a^{b/2}-\sqrt{b}) \times  (a^{b/2}+\sqrt{b}) &= 7 \times 11 \end{align} $$We know that \(a^{b/2}-\sqrt{b} < a^{b/2}+\sqrt{b}\) and so there are only two possible factorisations of 77. These are \(1 \times 77\) and \(7 \times 11 \). Not only is the second option more likely but the first option in fact does not yield a solution, as we'll show later. Let's proceed using the \(7 \times 11\) factorisation.$$ \begin{align} a^{b/2}-\sqrt{b} &=7 \dots 1\\ a^{b/2}+\sqrt{b} &=11 \dots 2 \end{align}$$Adding equations 1 and 2 together gives:$$ \begin{align} 2 a^{b/2} &=18 \\ a^{b/2} &=9 \\ \end{align}$$Let's substitute \(a^{b/2}=9\) back in the equation 1:$$ \begin{align} 9 - \sqrt{b} &= 7 \\ \sqrt{b} &= 2 \\ b &=4 \\ \because a^{b/2} &= 9 \\ a^2 &= 9 \\ a&=3 \end{align}$$So we have a solution with \(a = 3\) and \(b=4\). Substituting these values back into the original equation should confirm the solution:$$ \begin{align} a^b -b &= 77 \\ 3^4-4 &=77\\77 &= 77 \end{align}$$But what of the \(1 \times 77\) factorisation? Let's confirm that this does not yield a solution:$$ \begin{align} a^{b/2}-\sqrt{b} &=1 \dots 1\\ a^{b/2}+\sqrt{b} &=77 \dots 2 \end{align}$$Adding equations 1 and 2 together gives$$ \begin{align} 2a^{b/2} &=78\\ a^{b/2} &= 39 \end{align}$$Substitute \(a^{b/2}=39\) back in the equation 1:$$ \begin{align} 39 - \sqrt{b} &=77 \\ \sqrt{b}=-38 \end{align}$$There is no value of \(b\) that satisfies this equation so we can confirm that the \(1 \times 77\) factorisation does not yield a solution. I did not think up the method of solution described here and all credit is due the author of the linked video. It did occur to me to generalise the problem and consider what other biprimes (or semiprimes) yield a solution. In other words, what prime values of \(x\) and \(y\), with \(x<y\), allow for natural number solutions to:$$a^b-b=xy$$The two equations we obtain from this relationship are:$$ \begin{align} a^{b/2}-\sqrt{b} &=x \dots 1\\ a^{b/2}+\sqrt{b} &=y \dots 2 \end{align}$$Adding equations 1 and 2 gives:$$ \begin{align} 2a^{b/2} &= x+y \\ a^{b/2} &= \frac{x+y}{2} \end{align}$$Substituting into equation 1 gives:$$ \begin{align} \frac{x+y}{2}-\sqrt{b} &= x \\ \sqrt{b} &= \frac{x+y}{2}-x \\ \sqrt{b} &= \frac{x+y-2x}{2} \\ b &= \frac{(y-x)^2}{4}  \end{align}$$Testing this equation with \(x=7\) and \(y=11\) we see that \(b=4\) and so all is well. So what other prime values of \(x\) and \(y\) will yield solutions? Testing we find that \(x=3\) and \(y=5\) yield a value of \(b=1\). This leads to:$$ \begin{align} a^{b/2} &=\frac{x+y}{2}\\ \sqrt{a} &= 4 \\ a &=16 \end{align}$$Checking, we see that:$$ \begin{align} a^b-b &=15 \\ 16^1-1 &=15\\15 &= 15 \end{align}$$Rather than randomly checking prime values of \(x\) and \(y\), the design of a search algorithm is a more organised approach (permalink). Let's exclude those cases where either \(a=1\) or \(b=1\) as these are rather trivial. For semiprimes with prime factors less than 300, I found the following additional semiprimes (the calculations are very processor intenstive). The first is 6557:$$ \begin{align} 6557 &=79 \times 83 \\ \text{with } a &= 9 \text{ and }b= 4 \end{align}$$Checking, we find that:$$ \begin{align} a^b-b &= 6557 \\9^4 - 4 &= 6557 \\ 6561-4  &= 6557\\ 6557&=6557 \end{align}$$The second is 50621:$$ \begin{align} 50621 &=223 \times 227\\ \text{with } a &= 15 \text{ and }b= 4 \end{align}$$Checking, we find that:$$ \begin{align} a^b-b &= 50621 \\ 15^4 - 4 &= 50621\\50625-4 &= 50621\\50621 &= 50621 \end{align}$$The third is 194477:$$ \begin{align} 194477 &=439 \times 443 \\ \text{with } a &= 21 \text{ and } b=4 \end{align}$$Checking, we find that:$$ \begin{align} a^b-b &= 194477 \\ 21^4-4 &= 194477 \\ 194481-4 &= 194477 \\ 194477 &= 194477 \end{align}$$That's probably enough. As can be seen, the semiprimes that satisfy are few and far between but it was an interesting exercise. Notice that the prime factors in each case are adjacent primes.