Friday, 20 March 2026

Concatenating Emirpimes

Emirpimes have the property that they remain semiprimes when reversed. Thus 15 = 3 x 5 becomes 51 when the digits are reversed and 51 = 3 x 17 which is also a semiprime. What happens to the emirpimes if it is concatenated with its reverse. Does it remain a semiprime? In the case 15, this leads to 1551 = 3 x 11 x 47 which is a sphenic number and not a semiprime. The first such emirpimes is 94 because 9449 = 11 x 859 is a semiprime. In fact all such emirpimes will have 11 as a factor. Here is Gemini's explanation:

The reason no numbers starting with the digit 2 appear in your output comes down to two absolute mathematical rules regarding divisibility: the behavior of even-length palindromes and the properties of even numbers.

When you concatenate a number that begins with 2 with its exact reverse, you are guaranteeing that the resulting number will have at least three prime factors, which automatically disqualifies it from being a semiprime.

Here is the step-by-step breakdown of exactly why this happens:

1. The Concatenated Number is Always an Even-Length Palindrome

When you take any number string and append its exact reverse (e.g., $n = 26$, $rev = 62$, resulting in 2662), you create a perfect mirror image. Because you are doubling the number of digits, the resulting palindrome will always have an even length.

There is a fundamental rule in number theory: Every palindrome with an even number of digits is divisible by 11. Because your program only evaluates these concatenated mirror-images, every single number evaluated in that final step has 11 as one of its prime factors.

2. The Resulting Number Always Ends in 2

If your original number ($n$) starts with the digit 2, its reverse will naturally end with the digit 2. When you concatenate the original number with its reverse, the very last digit of the new string will be the last digit of the reverse.

For example:

  • Original: 215

  • Reverse: 512

  • Concatenation: 215512

Because the concatenated number ends in 2, it is an even number. This means 2 is definitively another prime factor of the concatenated number.

3. The Factor Count Exceeds the Semiprime Limit

By definition, a semiprime must have exactly two prime factors (e.g., $p_1 \times p_2$).

If you start with a number beginning with 2, we have already established that the final concatenated number is divisible by both 11 and 2. Therefore, the number is a multiple of 22.

For a multiple of 22 to be a semiprime, the number would have to be exactly 22 itself (where 2 and 11 are the only factors). For your program to generate 22, the original number would have to be 2, and the reverse would have to be 2. This fails on multiple fronts:

  • 2 is a prime number, not a semiprime.

  • Your code explicitly filters out palindromes (n != rev_n), so it would ignore 2 anyway.

Any valid concatenated number your program produces that begins with a 2 will be much larger than 22 (the smallest would be 2442, derived from $n=24$). Therefore, its prime factorization will always look like $2 \times 11 \times x$, containing at least three prime factors.

Broader Implications

Because of these exact same mathematical rules, your output will also never contain numbers starting with:

  • 4, 6, or 8: The resulting concatenations would all end in an even number, meaning they are divisible by 2 and 11, resulting in too many factors.

  • 5: The resulting concatenation would end in a 5, meaning it is divisible by 5 and 11, again resulting in too many factors.

The only numbers that can mathematically survive this final semiprime check are those starting with 1, 3, 7, or 9.

Here is the list of emirpimes that satisfy in the range up to 40,000 (permalink):

=== Emirpime Concatenation Statistics ===

Range evaluated: 1 to 40000

1. Semiprimes: 9790 (24.47% of the range)

2. Emirpimes: 3450 (8.62% of the range)

3. Successful Emirpimes: 476 (1.1900% of the range)

94, 115, 169, 185, 341, 355, 394, 398, 766, 794, 923, 926, 955, 985, 1027, 1046, 1141, 1174, 1195, 1202, 1238, 1247, 1306, 1343, 1366, 1382, 1417, 1418, 1466, 1642, 1658, 1703, 1714, 1754, 1757, 1769, 1843, 1891, 1915, 1927, 1985, 3047, 3062, 3071, 3091, 3097, 3098, 3103, 3151, 3166, 3227, 3317, 3385, 3403, 3473, 3599, 3635, 3646, 3653, 3785, 3817, 3866, 3949, 3959, 3979, 3983, 7051, 7058, 7082, 7094, 7165, 7169, 7183, 7186, 7223, 7226, 7235, 7274, 7291, 7318, 7346, 7354, 7367, 7403, 7522, 7637, 7655, 7663, 7715, 7754, 7795, 7849, 7855, 7981, 9121, 9242, 9259, 9346, 9427, 9569, 9578, 9593, 9599, 9617, 9727, 9755, 9809, 9946, 9953, 9983, 9997, 10033, 10085, 10129, 10195, 10261, 10342, 10345, 10462, 10466, 10483, 10517, 10541, 10546, 10558, 10637, 10673, 10705, 10805, 11006, 11141, 11147, 11249, 11302, 11306, 11363, 11366, 11539, 11563, 11591, 11641, 11651, 11653, 11654, 11714, 11723, 11851, 11893, 11917, 11945, 12001, 12013, 12067, 12127, 12146, 12199, 12202, 12217, 12283, 12317, 12361, 12367, 12439, 12458, 12494, 12509, 12674, 12718, 12751, 12758, 12761, 12851, 12877, 12913, 12937, 13102, 13106, 13133, 13142, 13193, 13273, 13322, 13373, 13391, 13459, 13529, 13637, 13739, 13742, 13787, 13817, 13934, 13993, 14015, 14111, 14171, 14213, 14219, 14242, 14261, 14273, 14291, 14318, 14359, 14486, 14501, 14611, 14642, 14647, 14765, 14786, 14834, 14999, 15094, 15157, 15335, 15362, 15389, 15403, 15623, 15658, 15779, 15781, 15793, 15815, 15863, 15874, 15893, 15989, 16003, 16123, 16129, 16153, 16207, 16265, 16331, 16334, 16367, 16387, 16489, 16507, 16859, 16865, 16909, 16969, 17083, 17218, 17261, 17305, 17311, 17441, 17503, 17533, 17611, 17614, 17662, 17687, 18035, 18155, 18463, 18482, 18547, 18613, 18623, 18686, 18689, 18695, 18794, 18806, 18847, 18937, 19015, 19165, 19217, 19246, 19286, 19297, 19331, 19337, 19354, 19358, 19405, 19445, 19579, 19585, 19607, 19637, 19667, 19757, 19858, 19882, 19931, 19969, 30043, 30143, 30182, 30407, 30413, 30437, 30574, 30605, 30607, 30641, 30662, 30731, 30754, 30755, 30779, 30826, 30854, 30865, 30886, 30913, 30991, 30994, 30995, 31127, 31138, 31282, 31342, 31399, 31453, 31807, 31843, 31853, 31946, 31969, 32066, 32071, 32137, 32138, 32177, 32366, 32455, 32458, 32501, 32593, 32602, 32663, 32666, 32765, 32842, 32845, 32891, 33109, 33253, 33257, 33445, 33458, 33559, 33593, 33737, 33991, 34073, 34154, 34169, 34186, 34187, 34205, 34379, 34382, 34409, 34477, 34571, 34598, 34657, 34723, 34745, 34802, 34831, 34907, 34999, 35078, 35135, 35137, 35147, 35173, 35215, 35263, 35269, 35285, 35471, 35522, 35545, 35567, 35723, 35773, 35779, 35813, 35881, 36029, 36035, 36065, 36139, 36143, 36203, 36227, 36311, 36422, 36427, 36446, 36481, 36503, 36535, 36614, 36626, 36631, 36649, 36679, 36733, 36734, 36745, 36794, 36802, 37006, 37031, 37034, 37099, 37153, 37157, 37231, 37331, 37358, 37399, 37438, 37457, 37477, 37487, 37498, 37514, 37574, 37601, 37739, 37834, 37837, 37931, 37946, 37958, 38174, 38209, 38245, 38401, 38413, 38414, 38477, 38497, 38534, 38585, 38597, 38635, 38719, 38785, 38806, 38951, 39037, 39127, 39142, 39205, 39253, 39265, 39289, 39449, 39518, 39523, 39653, 39797, 39826, 39871, 39898, 39899, 39911, 39931, 39947, 39958, 39959, 39977

Thursday, 19 March 2026

Fibonacci Forbidden Digits: A Variation

It occurred to me that it make more sense to simply declare a forbidden digit and then use any two seed numbers that do not contain this digit. As before, the digit is removed from any subsequent numbers that appear in the sequence. I put this suggestion to Gemini:

I'm thinking of a variation on the previous code whereby a forbidden digit is declared, let's so 1, but then the two seed numbers are chosen so that neither contain this digit and the digit is removed in all subsequent numbers appearing in the sequence. So the program with not accept seed numbers containing the forbidden digit so that this digit never appears. So the program will require the declaration of the forbidden digit and the two seed numbers (neither containing the forbidden digit) to get started. Apart from that, everything remains the same.

Here was Gemini's response:

This is a logical progression for the sequence. By strictly enforcing the forbidden digit at the point of entry, you completely isolate the sequence from that integer domain right from the start.

Here is the complete Python code, formatted to run in SageMathCell or a Jupyter Notebook. It includes the new validation logic to ensure the seed numbers are clean, retains the text-first output structure, and plots the graph with the exact visual specifications and headroom you established. 

Here is a SageMathCell permalink to the Gemini code (using a forbidden digit of 1 and seeds of 2 and 3. The output is:

Starting Parameters: Forbidden Digit = 1, Seeds = 2 and 3
Max Value Limit: 40000
--------------------------------------------------
Resulting Sequence (33 terms):
[2, 3, 5, 8, 3, 0, 3, 3, 6, 9, 5, 4, 9, 3, 2, 5, 7, 2, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, 0, 5, 5]
--------------------------------------------------
Conclusion: The sequence entered a continuous loop. 

The repeating pair that triggered the stop was: (5, 5) 


Even with these changes, the sequences behave the same as described in my earlier posts:

I prefer this variation to what I started with because the forbidden digit is truly forbidden and never makes an appearance even as a seed number.

Tuesday, 17 March 2026

There Can Be Only One 3

Let's recall the Fibonacci-like sequence from my previous two blog posts titled There Can Be Only One 1 and There Can Only Be One 2.

We start with a digit \(d\) between 0 and 9 and any integer \(s\) that does not contain \(d\). For example, 1 and 2 would be suitable. After that we begin the Fibonacci process using \(d\) and \(s\) as our seeds except that whenever a number appears containing one or more digits \(d\), they are all removed.

So far I've looked at:

  • \(d=1\) and \(s=2\) leading to a sequence that loops
  • \(d=1\) and \(s=24\) leading to a sequence that loops
  • \(d=1\) and \(s=70\) leading to a sequence that loops
  • \(d=2\) and \(s=1\) leading to sequence that is probably unbounded
  • \(d=2\) and \(s=5\) leading to a sequence that loops
Now let's look at what happens when we set \(d=3\) and \(s=1\). We very quickly end up with a sequence that loops. Here is the trajectory and Figure 1 shows the graph:

3, 1, 4, 5, 9, 14, 2, 16, 18, 4, 22, 26, 48, 74, 122, 196, 18, 214, 22


Figure 1: permalink

Once we set \(s=2\) and maintain \(d=3\), we get a longer sequence but it eventually loops. Here is the trajectory and Figure 2 shows the graph:

3, 2, 5, 7, 12, 19, 1, 20, 21, 41, 62, 10, 72, 82, 154, 26, 180, 206, 86, 292, 78, 70, 148, 218, 66, 284, 50, 4, 54, 58, 112, 170, 282, 452, 74, 526, 600, 1126, 1726, 2852, 4578, 740, 518, 1258, 1776, 4, 1780, 1784, 564, 248, 812, 1060, 1872, 292, 2164, 2456, 4620, 7076, 11696, 18772, 468, 19240, 19708, 8948, 28656, 7604, 6260, 1864, 8124, 9988, 18112, 28100, 46212, 7412, 5624, 106, 570, 676, 1246, 1922, 168, 2090, 2258, 448, 2706, 154, 2860, 14, 2874, 2888, 5762, 8650, 14412, 2062, 16474, 1856, 180


Figure 2: permalink

The sequence reaches a maximum of 46212 with the previous term being 28100. When these two numbers are added we get 74312 that collapses to 7412 and from there it struggles and eventually enters a loop.

It is only with \(d=3\) and \(s=4\) that we get a seemingly unbounded sequence (I tested to 10 million). Here is the trajectory and Figure 3 shows the graph:

3, 4, 7, 11, 18, 29, 47, 76, 12, 88, 100, 188, 288, 476, 764, 1240, 2004, 244, 2248, 2492, 4740, 722, 5462, 6184, 11646, 1780, 1426, 206, 162, 68, 20, 88, 108, 196, 4, 200, 204, 404, 608, 1012, 1620, 262, 1882, 2144, 4026, 6170, 10196, 1666, 11862, 1528, 190, 1718, 1908, 626, 254, 880, 114, 994, 1108, 2102, 210, 212, 422, 64, 486, 550, 106, 656, 762, 1418, 2180, 598, 2778, 76, 2854, 290, 144, 44, 188, 22, 210, 22, 22, 44, 66, 110, 176, 286, 462, 748, 1210, 1958, 168, 2126, 2294, 4420, 6714, 1114, 7828, 8942, 16770, 25712


Figure 3: permalink

So that will probably do it for now. We've seen that it was only with \(d=1\) that we inevitably end up with sequences that loop for values of \(s<100\). For \(d>1\), the sequences can loop or increase without bound depending on the values of \(s\).