Showing posts with label sequences. Show all posts
Showing posts with label sequences. Show all posts

Friday, 1 May 2026

Convolutions Revisited

On the 12th October 2025, I created a post titled A Practical Example of a Convolution which began as follows:

Over the past decade, for some reason, I've chosen to ignore 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).

I finished the post by saying:

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.

Unfortunately there was no future series of posts relating to convolutions but I was reminded of them once again thanks to the number associated with my diurnal age today: \( \textbf{28152}\). It is a member of OEIS A014342:


 A014342: Convolution of primes with themselves.

 The initial members are:

4, 12, 29, 58, 111, 188, 305, 462, 679, 968, 1337, 1806, 2391, 3104, 3953, 4978, 6175, 7568, 9185, 11030, 13143, 15516, 18177, 21150, 24471, \( \textbf{28152}\), 32197, 36678, 41543, 46828, 52621, 58874, 65659, 73000, 80949, 89462, 98631, 108396, 118869, 130102, 142071

This time around I got Gemini to explain how the convolution was calculated:

In the context of integer sequences like those found in the OEIS, a convolution (specifically, a discrete Cauchy convolution) is a mathematical way of combining two sequences to create a third. When a sequence is convolved with itself, you are multiplying its terms together in a symmetrical, sliding window and summing the results.

Here is the full breakdown of how this works for OEIS A014342.

The Formula

First, let's establish our base sequence, which is the sequence of prime numbers, denoted as pn:

    • p1 = 2
    • p2 = 3
    • p3 = 5
    • p4 = 7
    • p5 = 11
    • ...and so on.

The n-th term of the convolved sequence, let's call it cn, is calculated by taking the sum of the products of two primes whose indices add up to n + 1.

The formal equation looks like this:

cn = Σ (pi × pn-i+1)

(summed from i = 1 to n)

In simpler terms: to find the n-th number in your sequence, you line up the first n primes going forward, line up the exact same n primes going backward, multiply the overlapping pairs, and add those products together.

Step-by-Step Calculation

Here is how the first few members of the sequence are calculated using this method.

1st Term (n = 1):

We only use the first prime (p1 = 2).

c1 = (p1 × p1)

c1 = (2 × 2)

c1 = 4

2nd Term (n = 2):

We use the first two primes (2 and 3). We pair the first with the second, and the second with the first.

c2 = (p1 × p2) + (p2 × p1)

c2 = (2 × 3) + (3 × 2)

c2 = 6 + 6

c2 = 12

3rd Term (n = 3):

We use the first three primes (2, 3, and 5). Notice how the indices always add up to 4 (n + 1).

c3 = (p1 × p3) + (p2 × p2) + (p3 × p1)

c3 = (2 × 5) + (3 × 3) + (5 × 2)

c3 = 10 + 9 + 10

c3 = 29

4th Term (n = 4):

We use the first four primes (2, 3, 5, and 7).

c4 = (p1 × p4) + (p2 × p3) + (p3 × p2) + (p4 × p1)

c4 = (2 × 7) + (3 × 5) + (5 × 3) + (7 × 2)

c4 = 14 + 15 + 15 + 14

c4 = 58

5th Term (n = 5):

We use the first five primes (2, 3, 5, 7, and 11).

c5 = (p1 × p5) + (p2 × p4) + (p3 × p3) + (p4 × p2) + (p5 × p1)

c5 = (2 × 11) + (3 × 7) + (5 × 5) + (7 × 3) + (11 × 2)

c5 = 22 + 21 + 25 + 21 + 22

c5 = 111

The Pattern

As you calculate further into the sequence, this symmetrical "folding" action continues. You are always starting at the outer edges of your chosen set of primes and working your way inward to the middle, multiplying the pairs and summing them up. This specific operation is incredibly common in polynomials, probability theory, and signal processing, but when applied purely to integer sequences like the primes, it yields the exact sequence you provided.

Remember that SageMath makes it very easy to determine self-convolutions due to its formula convolutions(A, A) where A is any given set.

Sunday, 8 February 2026

The Revision Revisited

In my post titled A Revision, I outlined an alternative algorithm for building a sequence based on the factors of numbers considered with multiplicity. This is the algorithm:

Suppose we take any positive integer \(n \gt 1\) and apply the following rules to it:
  • if a \(4k+1\) prime, double it and add 1: \(n \rightarrow 2n+1\)
  • if a \(4k+3\) prime, subtract 1 and divide by 2: \(n \rightarrow (n-1)/2\)
  • if composite, determine its number of factors \(f\) counted \( \textbf{with multiplicity}\)
    • if \( n \pmod f \equiv 0\) then \(n \rightarrow \dfrac{n}{f} \)
    • if \( n \pmod f \not\equiv 0 \) then \(n \rightarrow n \times f\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations. 

What I'm interested in looking at in this post are the record lengths of sequences generated over a range of numbers, noting as well the highest and lowest values that are reached by sequence members. Figure 1 shows the results in the range from one to one million (permalink):


Figure 1

Let's now consider the algorithm where multiplicity is ignored. This algorithm in as follows:

Suppose we take any positive integer \(n \gt 1\) and apply the following rules to it:
  • if a \(4k+1\) prime, double it and add 1: \(n \rightarrow 2n+1\)
  • if a \(4k+3\) prime, subtract 1 and divide by 2: \(n \rightarrow (n-1)/2\)
  • if composite, determine its number of factors \(f\) counted \( \textbf{without multiplicity}\)
    • if \( n \pmod f \equiv 0\) then \(n \rightarrow \dfrac{n}{f} \)
    • if \( n \pmod f \not\equiv 0 \) then \(n \rightarrow n \times f\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations. 

Figure 2 shows the record lengths, highs and lows for the range from one to one million (permalink).


Figure 2

It can be noted that the record lengths of sequences are shorter when multiplicity is ignored and more end in 1 rather than a loop.

Saturday, 2 November 2024

Consolidating Fibonacci-like Numbers

In my post titled Additive Fibonacci-like Numbers I was dealing with additive digital roots to generate additional digits after the starting two digits were in place. For example, let's start with 78:$$ \begin{align} 78 \rightarrow 7 + 8 =15 \rightarrow 1+5=6 &\rightarrow 786 \\786 \rightarrow 8+6=14 \rightarrow 1+4=5 &\rightarrow 7865 \\7865 \rightarrow 6+5 =11 \rightarrow 1+1=2 &\rightarrow 78652 \end{align} $$We could keep going forever. The advantage of this approach is that the sum of the two previous digits reduces to a single digit between 1 and 9. Let's call these types of numbers Additive Fibonacci-like Numbers of the First Type. Between 100 and 1,000,000 these numbers are:

101, 112, 123, 134, 145, 156, 167, 178, 189, 191, 202, 213, 224, 235, 246, 257, 268, 279, 281, 292, 303, 314, 325, 336, 347, 358, 369, 371, 382, 393, 404, 415, 426, 437, 448, 459, 461, 472, 483, 494, 505, 516, 527, 538, 549, 551, 562, 573, 584, 595, 606, 617, 628, 639, 641, 652, 663, 674, 685, 696, 707, 718, 729, 731, 742, 753, 764, 775, 786, 797, 808, 819, 821, 832, 843, 854, 865, 876, 887, 898, 909, 911, 922, 933, 944, 955, 966, 977, 988, 999, 1011, 1123, 1235, 1347, 1459, 1562, 1674, 1786, 1898, 1911, 2022, 2134, 2246, 2358, 2461, 2573, 2685, 2797, 2819, 2922, 3033, 3145, 3257, 3369, 3472, 3584, 3696, 3718, 3821, 3933, 4044, 4156, 4268, 4371, 4483, 4595, 4617, 4729, 4832, 4944, 5055, 5167, 5279, 5382, 5494, 5516, 5628, 5731, 5843, 5955, 6066, 6178, 6281, 6393, 6415, 6527, 6639, 6742, 6854, 6966, 7077, 7189, 7292, 7314, 7426, 7538, 7641, 7753, 7865, 7977, 8088, 8191, 8213, 8325, 8437, 8549, 8652, 8764, 8876, 8988, 9099, 9112, 9224, 9336, 9448, 9551, 9663, 9775, 9887, 9999, 10112, 11235, 12358, 13472, 14595, 15628, 16742, 17865, 18988, 19112, 20224, 21347, 22461, 23584, 24617, 25731, 26854, 27977, 28191, 29224, 30336, 31459, 32573, 33696, 34729, 35843, 36966, 37189, 38213, 39336, 40448, 41562, 42685, 43718, 44832, 45955, 46178, 47292, 48325, 49448, 50551, 51674, 52797, 53821, 54944, 55167, 56281, 57314, 58437, 59551, 60663, 61786, 62819, 63933, 64156, 65279, 66393, 67426, 68549, 69663, 70775, 71898, 72922, 73145, 74268, 75382, 76415, 77538, 78652, 79775, 80887, 81911, 82134, 83257, 84371, 85494, 86527, 87641, 88764, 89887, 90999, 91123, 92246, 93369, 94483, 95516, 96639, 97753, 98876, 99999

However, in my previous post, Variations on the Taxi Cab Number, I was not working with the digital roots and this is a severe limitation. The early digits need to be small if the digits are to progress in a Fibonacci-like manner. That's why, in the range of numbers, up to one million, the largest number is 303369. This number is constructed as follows beginning with the first two digits 3 and 0:$$ \begin{align} 30 \rightarrow 3 + 0 &= 3 \rightarrow 303 \\ 303 \rightarrow 0+3 &=3 \rightarrow 3033\\3033 \rightarrow 3 + 3 &= 6 \rightarrow 30336\\30336 \rightarrow 3+6 &= 9 \rightarrow 303369 \end{align}$$We can't go any further because of the final two digits: 6 + 9 = 15. Let's call these types of numbers Additive Fibonacci-like Numbers of the Second Type. Between 100 and 1,000,000 these numbers are:

101, 112, 123, 134, 145, 156, 167, 178, 189, 202, 213, 224, 235, 246, 257, 268, 279, 303, 314, 325, 336, 347, 358, 369, 404, 415, 426, 437, 448, 459, 505, 516, 527, 538, 549, 606, 617, 628, 639, 707, 718, 729, 808, 819, 909, 1011, 1123, 1235, 1347, 1459, 2022, 2134, 2246, 2358, 3033, 3145, 3257, 3369, 4044, 4156, 4268, 5055, 5167, 5279, 6066, 6178, 7077, 7189, 8088, 9099, 10112, 11235, 12358, 20224, 21347, 30336, 31459, 40448, 101123, 112358, 202246, 303369

With bases higher than 10, the 1 to 9 digit limitation can be exceeded. For example in base 16, if we start as before with an initial 78 then a third digit is possible:$$78 \rightarrow 7 + 8 = 15 = F \rightarrow 78F$$Thus we have:$$ \begin{align} 78F_{16} &= 7 \times 16^2 + 8 \times 16 + 15 \\ &=1935_{10} \end{align} $$This means that 1935 is an Additive Fibonacci-like Number of the Second Type in base 16. Here is a list of numbers greater than 27000 and less than 40000 that are "additive Fibonacci-like" and of the "second type" in base 16 (permalink):

  • 28791 --> 7077
  • 29065 --> 7189
  • 29339 --> 729b
  • 29613 --> 73ad
  • 29887 --> 74bf
  • 32904 --> 8088
  • 33178 --> 819a
  • 33452 --> 82ac
  • 33726 --> 83be
  • 37017 --> 9099
  • 37291 --> 91ab
  • 37565 --> 92bd
  • 37839 --> 93cf

Additive Fibonacci-like Numbers of the Second Type in base 16 are thus:

28791, 29065, 29339, 29613, 29887, 32904, 33178, 33452, 33726, 37017, 37291, 37565, 37839

*****************************

Here the numbers greater than 27000 and less than 40000 for base 15:

  • 27128 --> 8088
  • 27370 --> 819a
  • 27612 --> 82ac
  • 27854 --> 83be
  • 30519 --> 9099
  • 30761 --> 91ab
  • 31003 --> 92bd
  • 33910 --> a0aa
  • 34152 --> a1bc
  • 34394 --> a2ce
  • 37301 --> b0bb
  • 37543 --> b1cd

Additive Fibonacci-like Numbers of the Second Type in base 15 are (permalink):

27128, 27370, 27612, 27854, 30519, 30761, 31003, 33910, 34152, 34394, 37301, 37543

*****************************

Here are the numbers greater than 27000 and less than 40000 for base 14 (permalink): 

  • 27590 --> a0aa
  • 27802 --> a1bc
  • 30349 --> b0bb
  • 30561 --> b1cd
  • 33108 --> c0cc
  • 35867 --> d0dd
  • 38628 --> 10112

Additive Fibonacci-like Numbers of the Second Type in base 14 are thus:

27590, 27802, 30349, 30561, 33108, 35867, 38628

*****************************

Here are the numbers greater than 27000 and less than 40000 for base 13 (permalink):

  • 28745 --> 10112
  • 31140 --> 11235
  • 33535 --> 12358
  • 35930 --> 1347b

Additive Fibonacci-like Numbers of the Second Type in base 13 are thus:

28745, 31140, 33535, 35930

*****************************

For base 12, there are none between 27000 and 40000 but for base 11 we have (permalink):

  • 29550 --> 20224
  • 31027 --> 21347
  • 32504 --> 2246a

Additive Fibonacci-like Numbers of the Second Type in base 11 are thus:

29550, 31027, 32504

*****************************

Just for completeness I'll now look at bases 10 and lower. For base 10, we have (permalink):

  • 30336 --> 30336
  • 31459 --> 31459

Additive Fibonacci-like Numbers of the Second Type in base 10 are thus:

30336, 31459

*****************************

For base 9 there are none but for base 8 there is one (permalink):

  • 33363 --> 101123

Additive Fibonacci-like Numbers of the Second Type in base 8 are thus :

33363

*****************************

For base 7, we have 

  • 34432 --> 202246

Additive Fibonacci-like Numbers of the Second Type in base 7 are thus:

34432

There are no suitable numbers in the range 27000 to 40000 for bases 2, 3, 4, 5 and 6. I've added this determination of whether a number is additive Fibonacci-like of the second type to my multipurpose algorithm.

RIGHT TO LEFT INSTEAD OF LEFT TO RIGHT

There's no compulsion to proceed from left to right when working with digits and so a new set of numbers can be generated by simply reversing the order of the digits. Thus Additive Fibonacci-like Numbers of the First Type are shown below where digit progression is from right to left:

101, 119, 128, 137, 146, 155, 164, 173, 182, 191, 202, 211, 229, 238, 247, 256, 265, 274, 283, 292, 303, 312, 321, 339, 348, 357, 366, 375, 384, 393, 404, 413, 422, 431, 449, 458, 467, 476, 485, 494, 505, 514, 523, 532, 541, 559, 568, 577, 586, 595, 606, 615, 624, 633, 642, 651, 669, 678, 687, 696, 707, 716, 725, 734, 743, 752, 761, 779, 788, 797, 808, 817, 826, 835, 844, 853, 862, 871, 889, 898, 909, 918, 927, 936, 945, 954, 963, 972, 981, 999, 1101, 1191, 1283, 1375, 1467, 1559, 1642, 1734, 1826, 1918, 2119, 2202, 2292, 2384, 2476, 2568, 2651, 2743, 2835, 2927, 3128, 3211, 3303, 3393, 3485, 3577, 3669, 3752, 3844, 3936, 4137, 4229, 4312, 4404, 4494, 4586, 4678, 4761, 4853, 4945, 5146, 5238, 5321, 5413, 5505, 5595, 5687, 5779, 5862, 5954, 6155, 6247, 6339, 6422, 6514, 6606, 6696, 6788, 6871, 6963, 7164, 7256, 7348, 7431, 7523, 7615, 7707, 7797, 7889, 7972, 8173, 8265, 8357, 8449, 8532, 8624, 8716, 8808, 8898, 8981, 9182, 9274, 9366, 9458, 9541, 9633, 9725, 9817, 9909, 9999, 11918, 12835, 13752, 14678, 15505, 15595, 16422, 17348, 18265, 19182, 21101, 21191, 22927, 23844, 24761, 25687, 26514, 27431, 28357, 29274, 31283, 32119, 33936, 34853, 35779, 36606, 36696, 37523, 38449, 39366, 41375, 42202, 42292, 43128, 44945, 45862, 46788, 47615, 48532, 49458, 51467, 52384, 53211, 54137, 55954, 56871, 57707, 57797, 58624, 59541, 61559, 62476, 63303, 63393, 64229, 65146, 66963, 67889, 68716, 69633, 71642, 72568, 73485, 74312, 75238, 76155, 77972, 78808, 78898, 79725, 81734, 82651, 83577, 84404, 84494, 85321, 86247, 87164, 88981, 89817, 91826, 92743, 93669, 94586, 95413, 96339, 97256, 98173, 99909, 99999

Similarly Additive Fibonacci-like Numbers of the Second Type are shown below where digit progression is from right to left:

101, 202, 211, 303, 312, 321, 404, 413, 422, 431, 505, 514, 523, 532, 541, 606, 615, 624, 633, 642, 651, 707, 716, 725, 734, 743, 752, 761, 808, 817, 826, 835, 844, 853, 862, 871, 909, 918, 927, 936, 945, 954, 963, 972, 981, 1101, 2202, 3211, 3303, 4312, 4404, 5321, 5413, 5505, 6422, 6514, 6606, 7431, 7523, 7615, 7707, 8532, 8624, 8716, 8808, 9541, 9633, 9725, 9817, 9909, 21101, 42202, 53211, 63303, 74312, 84404, 85321, 95413, 321101, 642202, 853211, 963303

If we proceed from left to right, then the third digit is the difference between the first and second digits and so on (this is the subtraction sequence mentioned in my previous post).

Wednesday, 6 December 2023

The Commas Sequence

The number associated with my diurnal age today, 27275, was one of those numbers for which there was a paucity of information. However, after some searching I discovered a reference to the number on this site with this interesting introduction:

Hello Math-Fun & SeqFan, 
WARNING! 
This sequence is *not* for OEIS mathematicians!
  • it is base-dependent!
  • it has black spots on its shirt!
  • it is badly defined (in pidgin-English)!
  • it is computed by hand...
(I would recommend it only for drunken ophthalmologists.)

I did not really understand the information provided on the site but the sequence of terms listed there, when entered into the OEIS, revealed that 27275 is a member of OEIS A121805:


 A121805

The "commas sequence": the lexicographically earliest sequence of positive numbers with the property that the sequence formed by the pairs of digits adjacent to the commas between the terms is the same as the sequence of successive differences between the terms.


The OEIS comments state that:
An equivalent, but more formal definition, is: a(1) = 1; for \(n \gt 1\), let \(x\) be the least significant digit of a(\(n\)-1); then:$$ \text{a}(n) = \text{a}(n-1) + x \times 10 + y$$where \(y\) is the most significant digit of a(\(n\)) and is the smallest such \(y\), if such a \(y\) exists. If no such \(y\) exists, stop. The sequence contains exactly 2137453 terms, with a(2137453)=99999945. The next term does not exist.

Replace each comma in the original sequence by the pair of digits adjacent to the comma; the result is the sequence of first differences between the terms of the sequence:

Sequence:   1, 12, 35, 94, 135, 186, 248, 331, 344, 387, 461, 475, ...

Differences: 11, 23, 59, 41 , 51 , 62 , 83 , 13 , 43 , 74 , 14 , ...

To illustrate the formula in the comment: a(6) = 186 and a(7) = 248 = 186 + 62.

The comments also provide Python code that will generate the sequence (permalink) but I don't really understand it. However, with the formula provided above was able to develop some SageMath code that generates the terms as well (permalink). The initial terms are:

1, 12, 35, 94, 135, 186, 248, 331, 344, 387, 461, 475, 530, 535, 590, 595, 651, 667, 744, 791, 809, 908, 997, 1068, 1149, 1240, 1241, 1252, 1273, 1304, 1345, 1396, 1457, 1528, 1609, 1700, 1701, 1712, 1733, 1764, 1805, 1856, 1917, 1988, 2070, 2072, 2094, 2136, 2198, 2280, 2282, 2304, 2346, 2408, 2490, 2492, 2514, 2556, 2618, 2700, 2702, 2724, 2766, 2828, 2910, 2912, 2934, 2976, 3039, 3132, 3155, 3208, 3291, 3304, 3347, 3420, 3423, 3456, 3519, 3612, 3635, 3688, 3771, 3784, 3827, 3900, 3903, 3936, 3999, 4093, 4127, 4201, 4215, 4269, 4363, 4397, 4471, 4485, 4539, 4633, 4667, 4741, 4755, 4809, 4903, 4937, 5012, 5037, 5112, 5137, 5212, 5237, 5312, 5337, 5412, 5437, 5512, 5537, 5612, 5637, 5712, 5737, 5812, 5837, 5912, 5937, 6013, 6049, 6145, 6201, 6217, 6293, 6329, 6425, 6481, 6497, 6573, 6609, 6705, 6761, 6777, 6853, 6889, 6985, 7042, 7069, 7166, 7233, 7270, 7277, 7354, 7401, 7418, 7505, 7562, 7589, 7686, 7753, 7790, 7797, 7874, 7921, 7938, 8026, 8094, 8142, 8170, 8178, 8266, 8334, 8382, 8410, 8418, 8506, 8574, 8622, 8650, 8658, 8746, 8814, 8862, 8890, 8898, 8986, 9055, 9114, 9163, 9202, 9231, 9250, 9259, 9358, 9447, 9526, 9595, 9654, 9703, 9742, 9771, 9790, 9799, 9898, 9987, 10058, 10139, 10230, 10231, 10242, 10263, 10294, 10335, 10386, 10447, 10518, 10599, 10690, 10691, 10702, 10723, 10754, 10795, 10846, 10907, 10978, 11059, 11150, 11151, 11162, 11183, 11214, 11255, 11306, 11367, 11438, 11519, 11610, 11611, 11622, 11643, 11674, 11715, 11766, 11827, 11898, 11979, 12070, 12071, 12082, 12103, 12134, 12175, 12226, 12287, 12358, 12439, 12530, 12531, 12542, 12563, 12594, 12635, 12686, 12747, 12818, 12899, 12990, 12991, 13002, 13023, 13054, 13095, 13146, 13207, 13278, 13359, 13450, 13451, 13462, 13483, 13514, 13555, 13606, 13667, 13738, 13819, 13910, 13911, 13922, 13943, 13974, 14015, 14066, 14127, 14198, 14279, 14370, 14371, 14382, 14403, 14434, 14475, 14526, 14587, 14658, 14739, 14830, 14831, 14842, 14863, 14894, 14935, 14986, 15047, 15118, 15199, 15290, 15291, 15302, 15323, 15354, 15395, 15446, 15507, 15578, 15659, 15750, 15751, 15762, 15783, 15814, 15855, 15906, 15967, 16038, 16119, 16210, 16211, 16222, 16243, 16274, 16315, 16366, 16427, 16498, 16579, 16670, 16671, 16682, 16703, 16734, 16775, 16826, 16887, 16958, 17039, 17130, 17131, 17142, 17163, 17194, 17235, 17286, 17347, 17418, 17499, 17590, 17591, 17602, 17623, 17654, 17695, 17746, 17807, 17878, 17959, 18050, 18051, 18062, 18083, 18114, 18155, 18206, 18267, 18338, 18419, 18510, 18511, 18522, 18543, 18574, 18615, 18666, 18727, 18798, 18879, 18970, 18971, 18982, 19003, 19034, 19075, 19126, 19187, 19258, 19339, 19430, 19431, 19442, 19463, 19494, 19535, 19586, 19647, 19718, 19799, 19890, 19891, 19902, 19923, 19954, 19995, 20047, 20119, 20211, 20223, 20255, 20307, 20379, 20471, 20483, 20515, 20567, 20639, 20731, 20743, 20775, 20827, 20899, 20991, 21003, 21035, 21087, 21159, 21251, 21263, 21295, 21347, 21419, 21511, 21523, 21555, 21607, 21679, 21771, 21783, 21815, 21867, 21939, 22031, 22043, 22075, 22127, 22199, 22291, 22303, 22335, 22387, 22459, 22551, 22563, 22595, 22647, 22719, 22811, 22823, 22855, 22907, 22979, 23071, 23083, 23115, 23167, 23239, 23331, 23343, 23375, 23427, 23499, 23591, 23603, 23635, 23687, 23759, 23851, 23863, 23895, 23947, 24019, 24111, 24123, 24155, 24207, 24279, 24371, 24383, 24415, 24467, 24539, 24631, 24643, 24675, 24727, 24799, 24891, 24903, 24935, 24987, 25059, 25151, 25163, 25195, 25247, 25319, 25411, 25423, 25455, 25507, 25579, 25671, 25683, 25715, 25767, 25839, 25931, 25943, 25975, 26027, 26099, 26191, 26203, 26235, 26287, 26359, 26451, 26463, 26495, 26547, 26619, 26711, 26723, 26755, 26807, 26879, 26971, 26983, 27015, 27067, 27139, 27231, 27243, 27275, 27327, 27399, 27491, 27503, 27535, 27587, 27659, 27751, 27763, 27795, 27847, 27919, 28011, 28023, 28055, 28107, 28179, 28271, 28283, 28315, 28367, 28439, 28531, 28543, 28575, 28627, 28699, 28791, 28803, 28835, 28887, 28959, 29051, 29063, 29095, 29147, 29219, 29311, 29323, 29355, 29407, 29479, 29571, 29583, 29615, 29667, 29739, 29831, 29843, 29875, 29927, 29999, 30092, 30115, 30168, 30251, 30264, 30307, 30380, 30383, 30416, 30479, 30572, 30595, 30648, 30731, 30744, 30787, 30860, 30863, 30896, 30959, 31052, 31075, 31128, 31211, 31224, 31267, 31340, 31343, 31376, 31439, 31532, 31555, 31608, 31691, 31704, 31747, 31820, 31823, 31856, 31919, 32012, 32035, 32088, 32171, 32184, 32227, 32300, 32303, 32336, 32399, 32492, 32515, 32568, 32651, 32664, 32707, 32780, 32783, 32816, 32879, 32972, 32995, 33048, 33131, 33144, 33187, 33260, 33263, 33296, 33359, 33452, 33475, 33528, 33611, 33624, 33667, 33740, 33743, 33776, 33839, 33932, 33955, 34008, 34091, 34104, 34147, 34220, 34223, 34256, 34319, 34412, 34435, 34488, 34571, 34584, 34627, 34700, 34703, 34736, 34799, 34892, 34915, 34968, 35051, 35064, 35107, 35180, 35183, 35216, 35279, 35372, 35395, 35448, 35531, 35544, 35587, 35660, 35663, 35696, 35759, 35852, 35875, 35928, 36011, 36024, 36067, 36140, 36143, 36176, 36239, 36332, 36355, 36408, 36491, 36504, 36547, 36620, 36623, 36656, 36719, 36812, 36835, 36888, 36971, 36984, 37027, 37100, 37103, 37136, 37199, 37292, 37315, 37368, 37451, 37464, 37507, 37580, 37583, 37616, 37679, 37772, 37795, 37848, 37931, 37944, 37987, 38060, 38063, 38096, 38159, 38252, 38275, 38328, 38411, 38424, 38467, 38540, 38543, 38576, 38639, 38732, 38755, 38808, 38891, 38904, 38947, 39020, 39023 

The OEIS comments also state that:

The similar sequence OEIS A139284, which starts at a(1)=2, persists even longer, ending at a(194697747222394) = 9999999999999918. 


 A139284

Analog of A121805, but starting with 2. 
                              


For some reason, my SageMath code only generates about a dozen times before looping endlessly but the Python code works fine and generates the following initial terms (permalink):

2, 24, 71, 89, 180, 181, 192, 214, 256, 319, 413, 447, 522, 547, 623, 659, 756, 824, 872, 901, 920, 929, 1020, 1021, 1032, 1053, 1084, 1125, 1176, 1237, 1308, 1389, 1480, 1481, 1492, 1513, 1544, 1585, 1636, 1697, 1768, 1849, 1940, 1941, 1952, 1973, 2005, 2057, 2129, 2221, 2233, 2265, 2317, 2389, 2481, 2493, 2525, 2577, 2649, 2741, 2753, 2785, 2837, 2909, 3002, 3025, 3078, 3161, 3174, 3217, 3290, 3293, 3326, 3389, 3482, 3505, 3558, 3641, 3654, 3697, 3770, 3773, 3806, 3869, 3962, 3985, 4039, 4133, 4167, 4241, 4255, 4309, 4403, 4437, 4511, 4525, 4579, 4673, 4707, 4781, 4795, 4849, 4943, 4977, 5052, 5077, 5152, 5177, 5252, 5277, 5352, 5377, 5452, 5477, 5552, 5577, 5652, 5677, 5752, 5777, 5852, 5877, 5952, 5977, 6053, 6089, 6185, 6241, 6257, 6333, 6369, 6465, 6521, 6537, 6613, 6649, 6745, 6801, 6817, 6893, 6929, 7026, 7093, 7130, 7137, 7214, 7261, 7278, 7365, 7422, 7449, 7546, 7613, 7650, 7657, 7734, 7781, 7798, 7885, 7942, 7969, 8067, 8145, 8203, 8241, 8259, 8357, 8435, 8493, 8531, 8549, 8647, 8725, 8783, 8821, 8839, 8937, 9016, 9085, 9144, 9193, 9232, 9261, 9280, 9289, 9388, 9477, 9556, 9625, 9684, 9733, 9772, 9801, 9820, 9829, 9928, 10009, 10100, 10101, 10112, 10133, 10164, 10205, 10256, 10317, 10388, 10469, 10560, 10561, 10572, 10593, 10624, 10665, 10716, 10777, 10848, 10929, 11020, 11021, 11032, 11053, 11084, 11125, 11176, 11237, 11308, 11389, 11480, 11481, 11492, 11513, 11544, 11585, 11636, 11697, 11768, 11849, 11940, 11941, 11952, 11973, 12004, 12045, 12096, 12157, 12228, 12309, 12400, 12401, 12412, 12433, 12464, 12505, 12556, 12617, 12688, 12769, 12860, 12861, 12872, 12893, 12924, 12965, 13016, 13077, 13148, 13229, 13320, 13321, 13332, 13353, 13384, 13425, 13476, 13537, 13608, 13689, 13780, 13781, 13792, 13813, 13844, 13885, 13936, 13997, 14068, 14149, 14240, 14241, 14252, 14273, 14304, 14345, 14396, 14457, 14528, 14609, 14700, 14701, 14712, 14733, 14764, 14805, 14856, 14917, 14988, 15069, 15160, 15161, 15172, 15193, 15224, 15265, 15316, 15377, 15448, 15529, 15620, 15621, 15632, 15653, 15684, 15725, 15776, 15837, 15908, 15989, 16080, 16081, 16092, 16113, 16144, 16185, 16236, 16297, 16368, 16449, 16540, 16541, 16552, 16573, 16604, 16645, 16696, 16757, 16828, 16909, 17000, 17001, 17012, 17033, 17064, 17105, 17156, 17217, 17288, 17369, 17460, 17461, 17472, 17493, 17524, 17565, 17616, 17677, 17748, 17829, 17920, 17921, 17932, 17953, 17984, 18025, 18076, 18137, 18208, 18289, 18380, 18381, 18392, 18413, 18444, 18485, 18536, 18597, 18668, 18749, 18840, 18841, 18852, 18873, 18904, 18945, 18996, 19057, 19128, 19209, 19300, 19301, 19312, 19333, 19364, 19405, 19456, 19517, 19588, 19669, 19760, 19761, 19772, 19793, 19824, 19865, 19916, 19977, 20049, 20141, 20153, 20185, 20237, 20309, 20401, 20413, 20445, 20497, 20569, 20661, 20673, 20705, 20757, 20829, 20921, 20933, 20965, 21017, 21089, 21181, 21193, 21225, 21277, 21349, 21441, 21453, 21485, 21537, 21609, 21701, 21713, 21745, 21797, 21869, 21961, 21973, 22005, 22057, 22129, 22221, 22233, 22265, 22317, 22389, 22481, 22493, 22525, 22577, 22649, 22741, 22753, 22785, 22837, 22909, 23001, 23013, 23045, 23097, 23169, 23261, 23273, 23305, 23357, 23429, 23521, 23533, 23565, 23617, 23689, 23781, 23793, 23825, 23877, 23949, 24041, 24053, 24085, 24137, 24209, 24301, 24313, 24345, 24397, 24469, 24561, 24573, 24605, 24657, 24729, 24821, 24833, 24865, 24917, 24989, 25081, 25093, 25125, 25177, 25249, 25341, 25353, 25385, 25437, 25509, 25601, 25613, 25645, 25697, 25769, 25861, 25873, 25905, 25957, 26029, 26121, 26133, 26165, 26217, 26289, 26381, 26393, 26425, 26477, 26549, 26641, 26653, 26685, 26737, 26809, 26901, 26913, 26945, 26997, 27069, 27161, 27173, 27205, 27257, 27329, 27421, 27433, 27465, 27517, 27589, 27681, 27693, 27725, 27777, 27849, 27941, 27953, 27985, 28037, 28109, 28201, 28213, 28245, 28297, 28369, 28461, 28473, 28505, 28557, 28629, 28721, 28733, 28765, 28817, 28889, 28981, 28993, 29025, 29077, 29149, 29241, 29253, 29285, 29337, 29409, 29501, 29513, 29545, 29597, 29669, 29761, 29773, 29805, 29857, 29929, 30022, 30045, 30098, 30181, 30194, 30237, 30310, 30313, 30346, 30409, 30502, 30525, 30578, 30661, 30674, 30717, 30790, 30793, 30826, 30889, 30982, 31005, 31058, 31141, 31154, 31197, 31270, 31273, 31306, 31369, 31462, 31485, 31538, 31621, 31634, 31677, 31750, 31753, 31786, 31849, 31942, 31965, 32018, 32101, 32114, 32157, 32230, 32233, 32266, 32329, 32422, 32445, 32498, 32581, 32594, 32637, 32710, 32713, 32746, 32809, 32902, 32925, 32978, 33061, 33074, 33117, 33190, 33193, 33226, 33289, 33382, 33405, 33458, 33541, 33554, 33597, 33670, 33673, 33706, 33769, 33862, 33885, 33938, 34021, 34034, 34077, 34150, 34153, 34186, 34249, 34342, 34365, 34418, 34501, 34514, 34557, 34630, 34633, 34666, 34729, 34822, 34845, 34898, 34981, 34994, 35037, 35110, 35113, 35146, 35209, 35302, 35325, 35378, 35461, 35474, 35517, 35590, 35593, 35626, 35689, 35782, 35805, 35858, 35941, 35954, 35997, 36070, 36073, 36106, 36169, 36262, 36285, 36338, 36421, 36434, 36477, 36550, 36553, 36586, 36649, 36742, 36765, 36818, 36901, 36914, 36957, 37030, 37033, 37066, 37129, 37222, 37245, 37298, 37381, 37394, 37437, 37510, 37513, 37546, 37609, 37702, 37725, 37778, 37861, 37874, 37917, 37990, 37993, 38026, 38089, 38182, 38205, 38258, 38341, 38354, 38397, 38470, 38473, 38506, 38569, 38662, 38685, 38738, 38821, 38834, 38877, 38950, 38953, 38986, 39049, 39142, 39165, 39218, 39301

Other starting numbers lead to other sequences. Starting with 4 we get OEIS A366492 for example. However, some starting values lead to a quickly terminating sequence. Some examples are 3 --> 36, 31 --> 45, 15 --> 72 and 43 --> 81. The OEIS crossreferences are helpful in this regard:
See A366487 and A367349 for first differences.
Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.
See also A260261, A042948.

Monday, 12 July 2021

Beyond the OEIS

OEIS stands for the Online Encyclopaedia of Integer Sequences and, in my study of the integers associated with my diurnal age, I've found it to be an invaluable resource. Any registered person can propose a new sequence and in my initial enthusiasm, I decided to do just that. However, I was met with a firm rebuff and accused of creating a vanity sequence based on my diurnal age. It became quickly apparent that the OEIS is zealously guarded by a small group of individuals who must be approached in a certain manner.

I registered again under a new name and approached the arbiters in a less open and more guarded manner and succeeded in having my future submissions approved. It still rankled that I had to adopt such an approach and for some time now I haven't bothered to make any further submissions. Just lately, it occurred to me that I could concoct my own sequences, store them on Google Docs and even make them shareable and discoverable by others with no approval from the OEIS required.

The OEIS is a great resource and Neil Sloane is to be congratulated on being the inspiration behind its inception but he is quite old now and the duty of care for his creation has passed on to younger people. Unfortunately, the clique who now control the OEIS has created an unwelcoming atmosphere that discourages submissions by new contributors. Given my own advanced age and consequent life experiences, I was quickly able to discern what approach was needed in order to get these little Napoleons on side. This is why I registered again under a new name.

Such accommodations shouldn't be necessary and many younger contributors would be put off after their first rebuff. It's probably time for a new database of sequences to be created. Legally, it shouldn't be possible to own a sequence of numbers and so anybody or any group should be able to extract whatever sequences they want and start afresh. So far the sequences that I've created are not currently in the OEIS and I developed them because the existing OEIS entries held no interest for me.

Here is the link to the Google document that I've created:

https://docs.google.com/document/d/1pFqKbLCbhNCZ6euoUavt5QucPHfLRdiicWH_OHBw1L4/edit?usp=sharing

I'm not suggesting that there's anything amazing about these sequences but they're just as meaningful as a lot of the rubbish sequences that clutter up the OEIS today. To get an idea of the flavour of what I've created, here is a link to my latest sequence. Follow the link to see all five of them. These are early days yet and I'm likely to modify the layout in the future but for now:

 

S005: Composite numbers for which the set of digits associated with their prime factors is equal to the set of digits associated with the numbers themselves.

    

This sequence is a subset of S001.  

The first member of this sequence is \(132 = 2^2 \times 3 \times 11\) with the set of digits associated with 132 being {1, 2, 3} and the set of digits associated with its prime factors of 2, 3 and 11 also being {1, 2, 3}. 
 
The second member of the sequence, 312, has digits that are a permutation of the first member and that thus form the same set {1, 2, 3}. \(132 = 2^3 \times 3 \times 13\) and so its prime factors are 2, 3 and 13 with the associated set of digits being {1, 2, 3}. 
 
An algorithm (permalink) to generate the members of the sequence in the range from 1 to 30,000 is: 
 
L=[]
lower,upper=1,30000
for n in [lower..upper]:
    if is_prime(n)==0:
        D=Set(n.digits())
        DS=D.subsets()
        P=prime_factors(n)
        PS=[]
        for p in P:
            PS+=p.digits()
            if Set(PS)== D:
                L.append(n)
print("There are",len(L),"eligible numbers in the range from",lower,"to",upper,":")
print("This constitutes",numerical_approx(len(L)/(upper-lower)*100,digits=3),"percent of the range")
print()
print(L)

There are 61 eligible numbers in the range from 1 to 30000 :

This constitutes 0.203 percent of the range.

[132, 312, 735, 1255, 1377, 1775, 1972, 3792, 4371, 4773, 5192, 6769, 7112, 7236, 7371, 7539, 9321, 11009, 11099, 11132, 11163, 11232, 11255, 11375, 11913, 12176, 12326, 12595, 12955, 13092, 13175, 13312, 13377, 13491, 13755, 14842, 15033, 15303, 15317, 15532, 16332, 17272, 17276, 17343, 17482, 17973, 17975, 19075, 19276, 20530, 21345, 21372, 22413, 22714, 23535, 24338, 25030, 25105, 27232, 27393, 27944]

ADDENDUM September 2nd 2021

It seems I'll never learn. I made the mistake of proposing another sequence to the OEIS, throwing myself at the mercy of the little Napoleons guard its gates. Admittedly I'd made a couple of errors and had fixed them but then somebody asked why I thought the sequence was interesting. Hmmm. I saw where it was going so I bailed out, never to return again. I've learned my lesson.

ADDENDUM October 5th 2025

I just noticed that I made a post titled One of a Kind? on the 21st January 2024 in which I note that the sequence is actually in the OEIS database. This is ironic because I was touting this sequence as my own discovery and yet it had already been discovered! Not to worry, it's the same sequence whether in my own database or the OEIS's.

Friday, 25 June 2021

Dying Rabbits

The title of this post may seem unusual for a mathematical blog but rabbits of course have a close association with the Fibonacci sequence. Well live, reproducing rabbits at least. The following explains what the rabbits are all about (source):

Fibonacci's Rabbits

In the West, the Fibonacci sequence first appears in the book Liber Abaci (1202) by Leonardo of Pisa, known as Fibonacci. Fibonacci considers the growth of an idealized (biologically unrealistic) rabbit population, assuming that:
    1. a single newly born pair of rabbits (one male, one female) are put in a field;
    2. rabbits are able to mate at the age of one month so that at the end of its second month a female can produce another pair of rabbits;
    3. rabbits never die and a mating pair always produces one new pair (one male, one female) every month from the second month on.
The puzzle that Fibonacci posed was: how many pairs will there be in one year?


Suppose we let the number of rabbit pairs in the field at the end of the nth month be denoted by \(F_n\).

Consider just the new "baby rabbit pairs" in the nth month. They must be equal in number to the pairs of rabbits that are mature enough to give birth to baby rabbits. This, of course, is precisely the number of rabbit pairs alive two months previously, \(F_{n−2}\).

Now the total number of rabbit pairs in the nth month is the number of pairs alive in the previous month (i.e., \(F_{n−1}\)) plus the number of new baby rabbit pairs, \(F_{n−2}\).

Thus, we have the following recursive definition for the nth Fibonacci number: $$F_0=F_1=1 \text{ and } F_n=F_{n−1}+F_{n−2}$$

The assumption that "rabbits never die" is big presumption for they do die and the formula for the Fibonacci sequence can be modified to account for this. I discovered this because my diurnal age at the time of writing this post is 26381 and this number happens to be a member of OEIS A023440:


 A023440

Dying rabbits: a(n) = a(n-1) + a(n-2) - a(n-10)                      


The sequence members, up to 26381, are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 88, 142, 228, 367, 590, 949, 1526, 2454, 3946, 6345, 10203, 16406, 26381.

The sequence is identical to the Fibonacci up to to the 10th term (55): 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 88, … because a(10) = a(9) + a(8) - a(0) = 34 + 21 - 0 = 55. However, with a(11) = a(10) + a(9) - a(1) = 55 + 34 - 1, it begins to differ because the oldest generation of rabbits dies off.

It’s easier to generate the terms using the generating function rather than a recursive sequence. In the case of OEIS A023440, this generating function is:$$\frac{x}{(x - 1)(x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 - 1)}$$Here is the SageMath code to generate the terms together with a permalink :

L, k=[], var('k')
S=sum(x^k for k in [2..9])
P=x/((x - 1)*(S - 1))
T=taylor(P,x,0,23).coefficients()
for t in T:
    L.append(t[0])
print(L)

It is easy to generalise this function to accommodate longevities other than 10. For example, changing the 9 to an 8 in the code above will generate OEIS A023439:

 
 A023439

Dying rabbits: a(n) = a(n-1) + a(n-2) - a(n-9)                        


Here is the SageMath code together with a permalink:

L, k=[], var('k')
S=sum(x^k for k in [2..8])
P=x/((x - 1)*(S - 1))
T=taylor(P,x,0,23).coefficients()
for t in T:
    L.append(t[0])
print(L)

There are OEIS sequences corresponding to a(n-3) to a(n-12). Of course the ratio of successive terms doesn't approach the golden ratio as it does with the Fibonacci terms. In the case of OEIS A023440, the ratio approaches 1.6079827279... rather than 1.6180339887... and in the case of OEIS A023439, the ratio approaches 1.6013473338...

So that's the story of the dying rabbits.

Sunday, 10 March 2019

Beyond Fibonacci

The Fibonacci sequence is the most famous example of a generalised sequence that begins with two seed numbers \( a \) and \( b \) and then proceeds as follows:$$ G_n=\begin{cases}a&\mbox{if }n=0;\\b&\mbox{if }n=1;\\G_{n-1}+G_{n-2}&\mbox{otherwise.}\end{cases} $$So \(G_3=b+a \), \(G_4=a+2b \) etc. It can be shown that the \(n\)-th term in the Fibonacci sequence is given by \( [ \phi ]^n/ \sqrt 5 \) (where the square brackets denote rounding to the nearest whole number) and so the question could be asked is there a general formula for calculating the \(n\)-th term of the generalised sequence \(a, b, a+b, a+2b, ... \)? Well, after watching this Numberphile video, it turns out that there is:


The formula is:$$G_n=\bigg [ \phi ^n \times \frac{(3 \sqrt 5 - 5) \, a + (5 - \sqrt 5) \, b}{10} \bigg ] $$When \(a=1\) and \(b=1\), we get \( [ \phi ]^n/ \sqrt 5 \) so all is well. When \(a=1 \) and \(b=3 \), we get simply \( [ \phi ]^n  \) and this generates the Lucas numbers: 1, 3, 4, 7, 11, ...

The Numberphile video makes the point that it is the number \( \sqrt 5 \) that is at the heart of this formula and thus underlies all these Fibonacci-like sequences that are generated from two seed numbers.

We can also consider not two but three seed numbers and this leads to what is called the Tribonacci sequence defined by:$$
T_n=\begin{cases}0&\mbox{if }n=0\\1&\mbox{if }n=1\\1&\mbox{if }n=2\\T_{n-1}+T_{n-2}+T_{n-3}&\mbox{if }n \geq 3\end{cases}

$$This leads to 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, ... and, just as the closed-form formula for the Fibonacci sequence involved the roots of the polynomial \(x^2-x-1\), it is reasonable to expect that the analogous formula for the tribonacci sequence involves the polynomial \(x^3-x^2-x-1\) and this is indeed the case. This polynomial has one real root:$$ \frac{1}{3} \bigg ( 1+ \sqrt[3] {19+ 3 \, \sqrt {33}} + \sqrt[3] {19 -\sqrt {33}} \bigg ) \approx 1.83929 $$ called the tribonacci constant and this is the ratio of successive pairs of terms. In other words:$$

\lim_{n \to \infty} \frac {T_{n+1}}{T_n}=\frac{1}{3} \bigg ( 1+ \sqrt[3] {19+ 3 \, \sqrt {33}} + \sqrt[3] {19 -\sqrt {33}} \bigg ) \approx 1.83929

$$The other two roots are complex conjugates (source). The generating function for the tribonacci numbers is quite similar to the generating function for the Fibonacci numbers:$$ \sum_0 ^ \infty \! T_n \, x^n = \frac {x}{1-x-x^2-x^3} $$