Showing posts with label triprime. Show all posts
Showing posts with label triprime. Show all posts

Sunday, 30 August 2026

Biprime and Triprime Chains

I noticed that the number 28273 has an interesting property. It is a triprime but its prime factors, when concatenated in ascending order, also form a triprime. The process can be repeated one more time. See the table below (permalink):

Step |          Number | Factorization
--------------------------------------------------
    1 |           28273 | 7^2 * 577
    2 |           77577 | 3 * 19 * 1361
    3 |         3191361 | 3 * 37 * 28751

This got me thinking about what numbers lead to record chains. I put Gemini to work and this is what it came up with in the range up to one million (permalink):

    Number |    Chain Length
----------------------------
         8 |               3
        44 |               5
      7685 |               8
     15831 |               9
    261291 |              10
    768932 |              11

As can be seen:
  • a chain of length 3 is reached before  there is a chain of length 2
  • a chain of length 5 is reached before there is chain of length 4
  • a chain of length 8 is reached before a chain of 6 or 7.

Let's examine 15831 from the above list and see what it's chain looks like (permalink).

Step |          Number | Factorization
--------------------------------------------------
    1 |           15831 | 3^2 * 1759
    2 |          331759 | 19^2 * 919
    3 |         1919919 | 3 * 59 * 10847
    4 |        35910847 | 7 * 103 * 49807
    5 |       710349807 | 3 * 271 * 873739
    6 |      3271873739 | 19 * 191 * 901591
    7 |     19191901591 | 37 * 701 * 739943
    8 |     37701739943 | 7 * 73 * 73780313
    9 |     77373780313 | 19 * 487 * 8362021

The same thing can be done for biprimes. The record lengths up to one million are as shown:

    Number |    Chain Length
----------------------------
         4 |               2
        10 |               4
       161 |               6
      1126 |               7
      1253 |               9
    100462 |              11

As can be seen:
  • a chain of length 4 is reached before a chain of length 3
  • a chain of length 6 is reached before there is a chain of length 5
  • a chain of length 9 is reached before there is a chain of length 8
  • a chain of length 11 is reached before there is a chain of length10

Let's examine 1253 from the above table.

 Step |          Number | Factorization
--------------------------------------------------
    1 |            1253 | 7 * 179
    2 |            7179 | 3 * 2393
    3 |           32393 | 29 * 1117
    4 |          291117 | 3 * 97039
    5 |          397039 | 29 * 13691
    6 |         2913691 | 11 * 264881
    7 |        11264881 | 1231 * 9151
    8 |        12319151 | 13 * 947627
    9 |        13947627 | 3 * 4649209

I've incorporated this analysis of biprimes and triprimes into my daily number analysis. Note that the biprimes can be square numbers e.g. \(49=7^2\) and the triprimes can contain repeated factors or even be cubic numbers e.g. \(44 = 2^2 \times 11\) or \(27 = 3^3\). Biprimes with no repeated factors are referred to as square-free biprimes while triprimes with no repeated factors are referred to as sphenic numbers.

There's room for extra investigation of course. I've only considered concatenation of prime factors in ascending order. Concatenations in any order could be considered. I've also only listed the record breakers as they first appear. For example, with the triprimes a chain of length 3 is reached by the number 8 before a chain of length 2 is reached. Thus I could consider what numbers first reach a given length. I'll consider these options in a future post.

Wednesday, 1 July 2026

Sphenic Number Chains

My previous post on the topic of chains of semiprimes in arithmetic progression prompted me to investigate similar chains formed by sphenic numbers. This time we are looking for the smallest sphenic number that is at the end of an arithmetic progression of \(n\) sphenic numbers as \(n\) ranges from 1 upwards. The result for \(n\) up to 18 is as follows (permalink):

30, 42, 102, 138, 174, 442, 1010, 2278, 2422, 6494, 10322, 10586, 12694, 21434, 28466, 56426, 62902, 145930

Let's look at 28466 that is at the end of a chain of 15 sphenic numbers with a common difference of 96 (permalink):

Arithmetic Progression of 15 Sphenic Numbers
Common Difference: 96
-------------------------------------------------------
Term   | Sphenic Number   | Factorisation
-------------------------------------------------------
1      | 27122            | 2 x 71 x 191
2      | 27218            | 2 x 31 x 439
3      | 27314            | 2 x 7 x 1951
4      | 27410            | 2 x 5 x 2741
5      | 27506            | 2 x 17 x 809
6      | 27602            | 2 x 37 x 373
7      | 27698            | 2 x 11 x 1259
8      | 27794            | 2 x 13 x 1069
9      | 27890            | 2 x 5 x 2789
10     | 27986            | 2 x 7 x 1999
11     | 28082            | 2 x 19 x 739
12     | 28178            | 2 x 73 x 193
13     | 28274            | 2 x 67 x 211
14     | 28370            | 2 x 5 x 2837
15     | 28466            | 2 x 43 x 331
-------------------------------------------------------

Other tables can be generated for the other values of \(n\) but the above table is the most relevant because it covers numbers (28274, 28370 and 28466) that are upcoming for me in terms of my diurnal age.

Here are the results for 16 sphenic numbers in arithmetic progression:

Arithmetic Progression of 16 Sphenic Numbers
Common Difference: 708
-------------------------------------------------------
Term   | Sphenic Number   | Factorisation
-------------------------------------------------------
1      | 45806            | 2 x 37 x 619
2      | 46514            | 2 x 13 x 1789
3      | 47222            | 2 x 7 x 3373
4      | 47930            | 2 x 5 x 4793
5      | 48638            | 2 x 83 x 293
6      | 49346            | 2 x 11 x 2243
7      | 50054            | 2 x 29 x 863
8      | 50762            | 2 x 17 x 1493
9      | 51470            | 2 x 5 x 5147
10     | 52178            | 2 x 7 x 3727
11     | 52886            | 2 x 31 x 853
12     | 53594            | 2 x 127 x 211
13     | 54302            | 2 x 19 x 1429
14     | 55010            | 2 x 5 x 5501
15     | 55718            | 2 x 13 x 2143
16     | 56426            | 2 x 89 x 317
-------------------------------------------------------

Sunday, 21 June 2026

Numbers Within Numbers

Let's formalise the concept of internal digits. Take a number like 28211. It's prime but if we remove the leftmost digits (2) and the rightmost digit (1), we are left with the number 821. This is the number within a number and it happens to be prime also. It is thus a member of OEIS A069686:


 A069686: primes whose internal digits form a prime.

The members of this sequence from 28000 to 40000 are (permalink):

28097, 28099, 28111, 28211, 28219, 28277, 28279, 28297, 28393, 28537, 28571, 28573, 28579, 28591, 28597, 28631, 28771, 28813, 28817, 28837, 28871, 28879, 29077, 29191, 29297, 29411, 29473, 29531, 29537, 29671, 29717, 29833, 29837, 29917, 30029, 30059, 30071, 30113, 30119, 30133, 30137, 30139, 30197, 30293, 30313, 30319, 30431, 30539, 30593, 30671, 30677, 30713, 30839, 30893, 30971, 30977, 31013, 31019, 31033, 31039, 31079, 31091, 31139, 31271, 31277, 31319, 31379, 31391, 31393, 31397, 31511, 31513, 31517, 31573, 31793, 31799, 31817, 31973, 31991, 32117, 32119, 32233, 32237, 32297, 32299, 32411, 32413, 32573, 32579, 32633, 32693, 32713, 32717, 32719, 32771, 32779, 32831, 32833, 32839, 32933, 32939, 33071, 33073, 33113, 33119, 33179, 33311, 33317, 33377, 33479, 33493, 33533, 33599, 33679, 33739, 33791, 33797, 33893, 34019, 34211, 34213, 34217, 34313, 34319, 34337, 34439, 34499, 34613, 34631, 34673, 34679, 34871, 34877, 34913, 34919, 35099, 35419, 35573, 35771, 35879, 35933, 35993, 35999, 36011, 36013, 36017, 36073, 36131, 36137, 36191, 36313, 36319, 36433, 36473, 36479, 36599, 36739, 36779, 36833, 36913, 36919, 37013, 37019, 37097, 37199, 37273, 37277, 37337, 37339, 37397, 37511, 37517, 37571, 37573, 37579, 37619, 37691, 37693, 37699, 37871, 37879, 38113, 38119, 38219, 38231, 38237, 38239, 38273, 38299, 38393, 38593, 38639, 38833, 38839, 38873, 39079, 39113, 39119, 39191, 39199, 39293, 39371, 39373, 39419, 39671, 39679, 39719, 39779, 39839, 39971, 39979

We can modify the algorithm to search for square numbers within square numbers. For example, \(144 = 12^2\) and its internal digit \(4 = 2^2\) and so it is a member of OEIS A069701:


 A069701: squares with internal digits also forming a square > 0.


The members up to 40000 are few and far between: 

144, 196, 441, 841, 1369, 3364, 4096, 5041, 8649, 10816, 11449, 20164, 38416.

So the takeaway from this is that every \(n\) digit number has an (\(n-2\)) digit number inside of it provided \(n>2\) and sequences can be developed by relating this internal number to the larger number of which it forms a part.

Let's consider numbers that are biprime and whose internal digits also form a biprime. Take 28189 as an example:$$ \begin{align} 28189 &= 7 \times 4027 \\ 818 &= 2 \times 409 \end{align}$$These sorts of numbers are not listed in the OEIS. 

Similarly for triprimes. Take 28055 as an example:$$ \begin{align} 28055 &= 5 \times 31 \times  181\\805 &= 5 \times 7 \times 23 \end{align}$$Of course we could consider numbers within numbers within numbers etc. but given that I'm mainly examining five digit numbers less than 40000, I'll leave off at numbers within numbers. Of course, these relationships between numbers and their respective internal numbers only apply with certainty in the number base under consideration (base 10 so far in this post). Take our earlier example of 28211 and its internal number of 821. Both are prime. Let's change to base 9:$$ \begin{align} 28211_{10} &= 42625_9 \rightarrow 265_9 \text{ as its internal number} \\ 265_9 &= 218_{10} \text{ which is clearly not prime} \end{align} $$Primeness is base independent and if a number is not prime in a certain base then it is not prime in any base. However, the inner number while not prime in base 10 may be prime if regarded as a number in another base. Let's illustrate this with 28019. It is a prime in base 10 where the inner number, 801, is divisible by 3. However, we can note the following:$$ \begin{align} 801_{12} &= 1153_{10} \text{ which is prime}\\801_{15} &= 1801_{10} \text{ which is prime} \end{align} $$I've incorporated the search for the following types of numbers into my number analysis algorithm so that the following types of numbers can be identified:
  • prime number whose internal number is also prime in any base from 2 to 16
  • biprime number whose internal number is also prime using base 10 only
  • triprime number whose internal number is also triprime using base 10 only
  • square number whose internal number is also square using base 10 only

Thursday, 13 November 2025

Claude to the Rescue

The number 27983, associated with my diurnal age today, has a property than confers it membership in OEIS A335752: the lexicographically earliest sequence of primes, each two of which sum to a triprime. The sequence begins: 3, 5, 47, 239, 3023, 27983, 53231, ... so let's confirm that these numbers satisfy using 3 as a starting point:
  • \(3 + 5 = 8 =2^3\)
  • \(3 + 47 = 50 = 2 \times 5^2\)
  • \(3 + 239 = 242 = 2 \times 11^2 \)
  • \(3 + 3023 = 3026 = 2 \times 17 \times 89 \)
  • \(3+27983 = 27986 = 2 \times 7 \times 1999\)


The sums above are all triprimes and we will find that any number in the list paired with any other number will produce a triprime. The code for this was included in the OEIS comments but was in Mathematica. I got Gemini to convert it to Python code and then Grok but in both cases the primeomega function was misunderstood with both claiming that primeomega(12) =2 and not 3. 

I didn't fully understand the Python code and was looking to Gemini and then Grok to explain it to me. It was only Claude that succeeded to my satisfaction. Here is the code followed by Claude's explanation. I think Claude will be my go to resource for anything to do with coding.

from sympy import nextprime, primeomega
ps = [3]
for _ in range(10):
    p = nextprime(ps[-1]) 
    while not all(primeomega(x + p) == 3 for x in ps):
        p = nextprime(p)
    ps.append(p)
print(ps)

I'd be happy to explain this code line by line! This code generates a sequence of prime numbers with a special property.

Code Breakdown

from sympy import nextprime, primeomega

Imports two functions from SymPy:
  • nextprime(\(n\)): Returns the next prime number greater than \(n\)
  • primeomega(\(n\)): Returns the total number of prime factors of \(n\) (counting multiplicity). For example, primeomega(12) = 3 because 12 = 2² × 3 (two 2's and one 3)
ps = [3]

Initializes the sequence with the first prime number 3. This list will store our special sequence of primes.

for _ in range(10):

Loops 10 times to find 10 more primes (so we'll have 11 total including the initial 3). The underscore _ is used when we don't need the loop variable.

p = nextprime(ps[-1])

Gets the next prime after the last element in our list. 
  • ps[-1] accesses the last element of the list
  • Initially, this gives nextprime(3) = 5
  • This is our candidate prime to add to the sequence
while not all(primeomega(x + p) == 3 for x in ps):
    p = nextprime(p)

This is the key part! It checks if the candidate prime \(p\) satisfies a special condition:
  • For every number \(x\) already in our list ps
  • The sum \(x + p\) must have exactly 3 prime factors (counting multiplicity)
  • If this condition fails for any \(x\), we move to the next prime candidate
  • This continues until we find a prime where all sums have exactly 3 prime factors
ps.append(p)

Adds the qualified prime to our sequence once it passes the test.

print(ps)

Prints the final sequence** of primes.

Example Walkthrough

Let's trace the first iteration:
1. Start with ps = [3]
2. Try p = 5: Check if 3 + 5 = 8 = 2³ has 3 prime factors ✓ (yes, three 2's)
3. Add 5 to list: ps = [3, 5]
4. Try p = 7: Check 3 + 7 = 10 = 2 × 5 (only 2 factors) ✗
5. Try p = 11: Check 3 + 11 = 14 = 2 × 7 (only 2 factors) ✗
6. Continue until finding a prime that works with both 3 and 5...

This creates a sequence where each new prime maintains the property that when added to any previous prime in the sequence, the result always has exactly 3 prime factors!

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

Now if we change the condition to primeomega = 2, we get the following sequence: 3, 7, 19, 139, 859, 8179, 173059, ... where it can be seen there is a big jump from 8179 to 173059. Testing this out using 3 again we see that:
  • \(3+7=10=2 \times 5\)
  • \(3+19=22=2 \times 11\)
  • \(3+139=142=2 \times 71\)
  • \(3+859=862=2 \times 431\)
  • \(3+8179=8182=2 \times 4091\)
  • \(3+173059=173062=2 \times 86531\)
The sequence is included in the OEIS as A113875: slowest growing sequence of primes having the prime-pairwise-average property: if i<j, (a(i)+a(j))/2 is prime. This makes sense in that 2 seems to be the common factor is all of the sums. 

The sequence with additional (very large) terms looks like this:
3, 7, 19, 139, 859, 8179, 173059, 1026199, 1827139, 15828679, 13187242759, 18732483199, 912492556939, 9130567625119

When we set primeomega = 4 we get the following sequence: 3, 13, 137, 1193, 4373, 26017, 33889, 495433, ... which is NOT listed in the OEIS. Again let's use 3 as our test number:
  • \(3+13=16=2^4\)
  • \(3+137=140=2^2 \times 5 \times 7\)
  • \(3+1193=1196=2^2 \times 13 \times 23\)
  • \(3+4373=4376=2^3 \times 547\)
  • \(3+26017=26020=2^2 \times 5 \times 1301\)
  • \(3+33889=33892=2^2 \times 37 \times 229\)
  • \(3+495433=495436=2^2 \times 29 \times 4271\)
That's probably a good place to stop.

Saturday, 7 January 2023

A Prime and Semiprime Generating Quadratic Polynomial

The quadratic \(2n^2+29\) is especially adept at generating primes and semiprimes. Initially it generates 29 distinct primes for \(n = 0, 1, \dots, 28\). The primes are:

29, 31, 37, 47, 61, 79, 101, 127, 157, 191, 229, 271, 317, 367, 421, 479, 541, 607, 677, 751, 829, 911, 997, 1087, 1181, 1279, 1381, 1487, 1597

When \(n=29\), the first semiprime, 1711 = 29 x 59 is generated. This is in fact how I first encountered this quadratic. My diurnal age today is 26941 and this number is a member of OEIS A241554:


 A241554

Semiprimes generated by the polynomial 2 * n^2 + 29                                     

 The initial members of the sequence are:

1711, 1829, 2077, 2479, 3071, 3901, 5029, 6527, 6757, 7471, 7967, 8479, 10397, 10981, 11581, 14141, 15167, 15517, 15871, 16591, 16957, 17701, 18079, 18847, 19631, 20837, 22927, 23791, 25567, 26941, 27877, 28829, 29797, 30287, 31279, 31781, 32287, 35941, 38117

In the range from 0 to 1000 (1001 numbers overall),  there are:

  • 497 primes or about 49.7%
  • 446 semiprimes or about 44.6%
  • 58 triprimes or about 0.58%

There are no numbers with more than three factors. The first triprime is reached when \(n=185\) and this is \(68479 = 31 \times 47^2\) and this is also the first square-free number as well. This means that none of the previous semiprimes are square numbers.

The first composite numbers with four prime factors is reached when \(n=1334\) and this is 3559141 = 29 x 31 x 37 x 107. In the range up to 5000, there are only twenty such numbers. These are:

  • 1334 --> 3559141 = 29 * 31 * 37 * 107
  • 1704 --> 5807261 = 31 * 37 * 61 * 83
  • 2444 --> 11946301 = 37 * 61 * 67 * 79
  • 2958 --> 17499557 = 29 * 37 * 47 * 347
  • 3132 --> 19618877 = 29 * 31 * 139 * 157
  • 3481 --> 24234751 = 47 * 61 * 79 * 107
  • 3628 --> 26324797 = 31 * 37 * 59 * 389
  • 3688 --> 27202717 = 31 * 59 * 107 * 139
  • 3857 --> 29752927 = 29 * 47 * 83 * 263
  • 3945 --> 31126079 = 47 * 79 * 83 * 101
  • 3998 --> 31968037 = 31 * 37 * 47 * 593
  • 4031 --> 32497951 = 29 * 31 * 37 * 977
  • 4186 --> 35045221 = 31 * 47 * 67 * 359
  • 4277 --> 36585487 = 31 * 59 * 83 * 241
  • 4327 --> 37445887 = 37 * 47 * 61 * 353
  • 4438 --> 39391717 = 37 * 83 * 101 * 127
  • 4640 --> 43059229 = 29 * 61 * 101 * 241
  • 4775 --> 45601279 = 31 * 37 * 83 * 479
  • 4859 --> 47219791 = 67^3 * 157
  • 4930 --> 48609829 = 29 * 31 * 139 * 389
Overall, in the range up to 5000, there are:

  • 1920 primes or about 38%
  • 2436 semiprimes or about 49%
  • 625 triprimes or about 12.5%
  • 20 other composite numbers (listed above) or less than 0.5%
If we extend the range to 10000, there are (permalink):
  • 3484 primes or about 35%
  • 4904 semiprimes or about 49%
  • 1540 triprimes or about 15.5%
  • 73 other composite numbers or about 0.5%
In the range up to 100000 there are:
  • 27545 primes or about 27%
  • 46605 semiprimes or about 47%
  • 22575 triprimes or about 23%
  • 3276 other composite numbers or about 3%
Thus as the range increases, the percentage of primes steadily decreases (49.7% --> 38% --> 35% --> 27%) while the percentage of semiprimes remains fairly steady (44.6% --> 49% --> 49% --> 47%). Overall, this quadratic would seem to be best at producing semiprimes and at a steady rate of almost 50%.

I do make passing reference to this quadratic polynomial in a post from February 26th 2022 titled Another Prime Generating Polynomial. It appears in the following table:


As can be seen, \(2n^2+29\) makes an appearance together with \(2n^2+11\), these being the only quadratic polynomials without a linear term. I also have an earlier post from March 18th 2020 titled Prime Generating Quadratic Polynomials.