There is a set of non-square semiprimes defined by two criteria:
- the two prime factors concatenate in either order to form two new semiprimes
- the digits of the two prime factors can each be rearranged to form semiprimes
There is a set of non-square semiprimes defined by two criteria:
Every Fermat number greater than 257 has a prime factor of the form \(384 \times k + 257, k > 0\).
Let's test this out with the initial Fermat numbers greater than 257. Now \( \text{F}_4=65537\) is a prime and so it is its own prime factor and we find that:$$65537 = 384 \times 170 + 257$$The next Fermat numbers listed above are all composite so we need to check their prime factors:$$ \begin{align} \text{F}_5=4294967297 &= 641 \times 6700417 \\ 641 &= 384 \times 1 + 257 \end{align}$$ $$ \begin{align} \text{F}_6=18446744073709,551,617 &=274177 × 67280421310721\\ 67280421310721 &= 384 \times 175209430496+257 \end{align}$$I won't attempt \( \text{F}_7 \) as it's too lengthy but the point is made. There's an explanation that Gemini provided as to why at least one prime factor of a Fermat number must have this form. You can check that out here.
The number associated with my diurnal age today (28262) is what might be termed a "super sphenic number" as I'll explain in this post. Firstly however, its factorisation:$$28262=2 \times 13 \times 1087$$If we reverse its digits, we get the number 26282 and this number is also sphenic:$$26282 = 2 \times 17 \times 773$$Let's now concatenate the factors of 28262 in ascending order. This gives us the number 2131087 which is also sphenic:$$2131087 = 7 \times 167 \times 1823$$28262 has a sum of digits of 20 and if we add this to the original number we get the palindromic number 28282 which is also sphenic:$$28262+20=28282 = 2 \times 79 \times 179$$The number has a product of digits of 384 and if we subtract this from the original number we get 27878 which is sphenic:$$28262 - 384 = 27878 = 2 \times 53 \times 263$$If we consider only the internal digits of 28262, we get the number 826 which is also sphenic:$$2\, 826 \, 2 \rightarrow826=2 \times 7 \times 59$$When a sphenic number is considered as a sphenic brick then it has an associated number in the form of the brick's surface area. In the case of 28262, this associated surface area is 32662 square units and this number too is sphenic:$$32662 = 2 \times 7 \times 2333$$28262 has a sum of proper divisors that is also sphenic:$$ \sigma(28262) - 28262 =17434 = 2 \times 23 \times 379 $$The number has a sum of prime factors (1102) that is sphenic:$$2 +13+1087=1102 = 2 \times 19 \times 29$$28262 has a totient of 13032 which is not sphenic but its cototient (number - totient) of 15230 is:$$28262 - 13032 = 15230 = 2 \times 5 \times 1523$$So we can see that 28262 may well be termed a super sphenic number because of the above associations.
Smith numbers have the property that the sums of their digits are equal to the sums of the digits of their prime factors with multiplicity. Based on that criterion, the number associated with my diurnal age today, 28174, is a Smith number:$$28174=2 \times 14087$$This number however, has a further property if you look at it closely. The number and its prime factors share the same digits with the exception of the zero. This qualifies it for membership in OEIS A176670:
The initial members of the sequence are:
1111, 1255, 12955, 17482, 25105, 28174, 51295, 81229, 91365, 100255, 101299, 105295, 107329, 110191, 110317, 117067, 124483, 127417, 129595, 132565, 137281, 145273, 146137, 149782, 163797, 171735, 174082, 174298, 174793, 174982, 193117, 208174, 210181, 217894
The table below shows the details:
number digit sum factors sum of factors' digits 1111 4 11 * 101 4 1255 13 5 * 251 13 12955 22 5 * 2591 22 17482 22 2 * 8741 22 25105 13 5 * 5021 13 28174 22 2 * 14087 22 51295 22 5 * 10259 22 81229 22 29 * 2801 22 91365 24 3 * 5 * 6091 24 100255 13 5 * 20051 13 101299 22 11 * 9209 22 105295 22 5 * 21059 22 107329 22 29 * 3701 22 110191 13 101 * 1091 13 110317 13 107 * 1031 13 117067 22 167 * 701 22 124483 22 281 * 443 22 127417 22 47 * 2711 22 129595 31 5 * 25919 31 132565 22 5 * 26513 22 137281 22 107 * 1283 22 145273 22 53 * 2741 22 146137 22 317 * 461 22 149782 31 2 * 74891 31 163797 33 3 * 71 * 769 33 171735 24 3 * 5 * 107^2 24 174082 22 2 * 87041 22 174298 31 2 * 87149 31 174793 31 47 * 3719 31 174982 31 2 * 87491 31 193117 22 113 * 1709 22 208174 22 2 * 104087 22 210181 13 101 * 2081 13 217894 31 2 * 108947 31What's interesting is that these same digits show up several times in the above table:
All these numbers are xenodromes meaning that they have no repeated digits.
The obverse of this is to find all Smith numbers that have NO digits in common with their prime factors. There are 72 of these in the range up 40000 (permalink):
4, 27, 58, 166, 454, 576, 588, 627, 648, 654, 666, 690, 706, 729, 1449, 1858, 1908, 2067, 2409, 2839, 4369, 4414, 4464, 4880, 4960, 5458, 5818, 5854, 6084, 6096, 6567, 6583, 6684, 6718, 6760, 6880, 7068, 7078, 7186, 8158, 8568, 8680, 8864, 8901, 9166, 9414, 9849, 10669, 10786, 10966, 14458, 14566, 14958, 15646, 15709, 15984, 16546, 16866, 17496, 17664, 17718, 17840, 18418, 18454, 19818, 20229, 20299, 22509, 26727, 33680, 33760, 33880
The table below shows the details:
number digit sum factors sum of factors' digits 4 4 2^2 4 27 9 3^3 9 58 13 2 * 29 13 166 13 2 * 83 13 454 13 2 * 227 13 576 18 2^6 * 3^2 18 588 21 2^2 * 3 * 7^2 21 627 15 3 * 11 * 19 15 648 18 2^3 * 3^4 18 654 15 2 * 3 * 109 15 666 18 2 * 3^2 * 37 18 690 15 2 * 3 * 5 * 23 15 706 13 2 * 353 13 729 18 3^6 18 1449 18 3^2 * 7 * 23 18 1858 22 2 * 929 22 1908 18 2^2 * 3^2 * 53 18 2067 15 3 * 13 * 53 15 2409 15 3 * 11 * 73 15 2839 22 17 * 167 22 4369 22 17 * 257 22 4414 13 2 * 2207 13 4464 18 2^4 * 3^2 * 31 18 4880 20 2^4 * 5 * 61 20 4960 19 2^5 * 5 * 31 19 5458 22 2 * 2729 22 5818 22 2 * 2909 22 5854 22 2 * 2927 22 6084 18 2^2 * 3^2 * 13^2 18 6096 21 2^4 * 3 * 127 21 6567 24 3 * 11 * 199 24 6583 22 29 * 227 22 6684 24 2^2 * 3 * 557 24 6718 22 2 * 3359 22 6760 19 2^3 * 5 * 13^2 19 6880 22 2^5 * 5 * 43 22 7068 21 2^2 * 3 * 19 * 31 21 7078 22 2 * 3539 22 7186 22 2 * 3593 22 8158 22 2 * 4079 22 8568 27 2^3 * 3^2 * 7 * 17 27 8680 22 2^3 * 5 * 7 * 31 22 8864 26 2^5 * 277 26 8901 18 3^2 * 23 * 43 18 9166 22 2 * 4583 22 9414 18 2 * 3^2 * 523 18 9849 30 3 * 7^2 * 67 30 10669 22 47 * 227 22 10786 22 2 * 5393 22 10966 22 2 * 5483 22 14458 22 2 * 7229 22 14566 22 2 * 7283 22 14958 27 2 * 3^3 * 277 27 15646 22 2 * 7823 22 15709 22 23 * 683 22 15984 27 2^4 * 3^3 * 37 27 16546 22 2 * 8273 22 16866 27 2 * 3^2 * 937 27 17496 27 2^3 * 3^7 27 17664 24 2^8 * 3 * 23 24 17718 24 2 * 3 * 2953 24 17840 20 2^4 * 5 * 223 20 18418 22 2 * 9209 22 18454 22 2 * 9227 22 19818 27 2 * 3^3 * 367 27 20229 15 3 * 11 * 613 15 20299 22 53 * 383 22 22509 18 3^2 * 41 * 61 18 26727 24 3 * 59 * 151 24 33680 20 2^4 * 5 * 421 20 33760 19 2^5 * 5 * 211 19 33880 22 2^3 * 5 * 7 * 11^2 22
![]() |
Figure 1 |
Naturally, I wondered how many other numbers share this property and so I set Gemini to investigate this with the following prompt:
Write a program in Python, tailored for insertion into SageMathCell or a Jupyter notebook, that identifies all composite numbers from 4 up to a user chosen upper limit with the property that the prime factors, when arranged in a suitable order and then concatenated, produce a palindromic number. The default upper limit can be set to 40000. An example of such a number would be 313131 = 3 x 7 x 13 x 31 x 37 that can written as 7 x 3 x 13 x 31 x 37 to produce the palindromic number 73133137 when concatenated. The output of the program should be a table showing number and factorisation followed by a comma separated list of the qualifying numbers.
Naturally this a processor intensive process and my Jupyter notebook struggled mightily to generate the list of suitable numbers. After some time, I decided to restrict the range to between 28000 and 29000 and after further modifications by Gemini, I was able to achieve the following list of numbers:
28072, 28125, 28194, 28224, 28242, 28273, 28308, 28322, 28332, 28416, 28431, 28448, 28585, 28589, 28593, 28601, 28602, 28609, 28620, 28672, 28685, 28692, 28750, 28800, 28812, 28847, 28951
Figure 2 shows the details:
![]() |
Figure 2 |
![]() |
Figure 3 |
import sys
def get_prime_factors(n):
"""Returns a list of prime factors of n."""
factors = []
d = 2
temp = n
while d * d <= temp:
while temp % d == 0:
factors.append(d)
temp //= d
d += 1
if temp > 1:
factors.append(temp)
return factors
def is_palindrome(s):
"""Checks if a string is a palindrome."""
return s == s[::-1]
def distinct_permutations(iterable):
"""
Yields unique permutations of items in iterable.
This handles repeated elements efficiently (e.g., [2, 2, 3])
without generating all n! redundant combinations.
"""
# Sort the list to start with the lexicographically first permutation
s = sorted(iterable)
yield tuple(s)
n = len(s)
while True:
# 1. Find the largest index i such that s[i] < s[i+1]
i = n - 2
while i >= 0 and s[i] >= s[i+1]:
i -= 1
if i == -1:
return # All permutations generated
# 2. Find the largest index j such that s[i] < s[j]
j = n - 1
while s[j] <= s[i]:
j -= 1
# 3. Swap s[i] and s[j]
s[i], s[j] = s[j], s[i]
# 4. Reverse the sequence from s[i+1] up to the end
s[i+1:] = s[i+1:][::-1]
yield tuple(s)
def find_palindromic_composites(start_n, end_n):
results = []
actual_start = max(4, start_n)
for n in range(actual_start, end_n + 1):
factors = get_prime_factors(n)
# Skip primes
if len(factors) < 2:
continue
found_property = False
winning_perm = None
winning_concat = None
# Use the optimized generator instead of itertools.permutations
for p in distinct_permutations(factors):
concat_str = "".join(map(str, p))
if is_palindrome(concat_str):
found_property = True
winning_perm = p
winning_concat = concat_str
break
if found_property:
fact_str = " x ".join(map(str, winning_perm))
results.append((n, fact_str, winning_concat))
return results
# --- Configuration ---
LOWER_BOUND = 28000
UPPER_BOUND = 29000
# --- Main Execution ---
print(f"Searching for composite numbers between {LOWER_BOUND} and {UPPER_BOUND}...")
print("-" * 80)
print(f"{'Number':<8} | {'Valid Factor Ordering':<35} | {'Resulting Palindrome'}")
print("-" * 80)
qualifying_numbers = find_palindromic_composites(LOWER_BOUND, UPPER_BOUND)
if not qualifying_numbers:
print(f"No qualifying numbers found in the range {LOWER_BOUND} to {UPPER_BOUND}.")
else:
for num, factor_str, pal_str in qualifying_numbers:
print(f"{num:<8} | {factor_str:<35} | {pal_str}")
print("-" * 80)
print("\nComma separated list of qualifying numbers:")
print(", ".join(str(r[0]) for r in qualifying_numbers))
A recent number, 27960, associated with my diurnal age has an interesting property if you look at the prime factors more closely:$$27960=2^3 \times 3 \times 5 \times 233$$Let's ignore multiplicity and look at the sum of digits of each distinct prime factor. The 2, 3 and 5 remain the same but 233 becomes 8 and the sequence of prime factors then becomes:$$2, 3, 5, 8$$This is the Fibonacci sequence. How many numbers with four prime factors (ignoring multiplicity) have this property. Well, in the range up to 40000, it turns out that there are 115. These numbers are (permalink):
510, 1020, 1530, 1590, 2040, 2130, 2550, 3060, 3180, 3210, 4080, 4260, 4590, 4770, 5100, 6120, 6360, 6390, 6420, 6990, 7314, 7530, 7650, 7950, 8160, 8520, 8670, 9180, 9540, 9630, 9798, 10200, 10650, 12240, 12720, 12750, 12780, 12840, 12930, 13038, 13770, 13980, 14310, 14628, 14766, 15060, 15090, 15300, 15630, 15900, 16050, 16320, 17040, 17085, 17340, 17466, 18360, 19080, 19170, 19260, 19596, 20400, 20970, 21030, 21300, 21942, 22590, 22950, 23850, 24480, 25440, 25500, 25560, 25680, 25860, 26010, 26076, 26322, 27540, 27960, 28620, 28890, 29256, 29394, 29532, 30120, 30180, 30600, 31260, 31800, 31830, 31950, 32100, 32154, 32637, 32640, 34080, 34530, 34638, 34680, 34932, 34950, 35445, 35511, 36690, 36720, 37650, 38160, 38250, 38340, 38520, 38790, 39114, 39192, 39750
Lets consider the last number in this list: 39750. In this case we have:$$ \begin{align} 39750 &= 2 \times 3 \times 5^3 \times 53 \\ & \rightarrow 2, 3, 5, 8 \end{align}$$If we extend the number of prime factors to five, then only one number satisfies in the range up to 40000:$$ \begin{align}34170 &= 2 \times 3 \times 5 \times 17 \times 67 \\ &\rightarrow 2, 3, 5, 8, 13 \end{align}$$However, there are 160 numbers that satisfy in the range up to one million (permalink). The algorithm actually looks for generalised Fibonacci sequences:$$a,b,c,d,e, \dots \text{ such that } c = a+b, d=b+c, e=c+d \dots$$However, all of the 160 numbers begin with 2. For example, the last of the numbers is 9988520:$$ \begin{align} 998520 &= 2^3 \times 3 \times 5 \times 53 \times 157 \\ &\rightarrow 2, 3, 5, 8, 13 \end{align} $$I tried with six prime factors but without success up to 100 million. Finally I realised that any suitable number must add to 21 and thus be divisible by 3. Such a number can never be a prime factor and so the prime factor sequence must end at 13 and can never progress further.
I was struggling to find something that caught my fancy regarding the number associated with my diurnal age today: 27929. I thought I'd look at its reverse, 92972, and compare their factorisations. The results were:$$ \begin{align} 27929 &= 11 \times 2539 \\ 92972 &=2^2 \times 11 \times 2113 \end{align} $$Clearly, the number and its reverse share a common prime factor of 11. I then realised that 27929 has a digit sum of 29 and the two digits, when added together, give 11. So I then decided to look for numbers with the following properties:
number factors reverse factors digit sum sum
20999 11 * 23 * 83 99902 2 * 11 * 19 * 239 29 11
21989 11 * 1999 98912 2^5 * 11 * 281 29 11
22979 11 * 2089 97922 2 * 11 * 4451 29 11
23969 11 * 2179 96932 2^2 * 11 * 2203 29 11
24959 11 * 2269 95942 2 * 7^2 * 11 * 89 29 11
25949 7 * 11 * 337 94952 2^3 * 11 * 13 * 83 29 11
26939 11 * 31 * 79 93962 2 * 11 * 4271 29 11
27929 11 * 2539 92972 2^2 * 11 * 2113 29 11
28919 11^2 * 239 91982 2 * 11 * 37 * 113 29 11
29909 11 * 2719 90992 2^4 * 11^2 * 47 29 11
30899 11 * 53^2 99803 11 * 43 * 211 29 11
30998 2 * 11 * 1409 89903 11^2 * 743 29 11
31889 11 * 13 * 223 98813 11 * 13 * 691 29 11
31988 2^2 * 11 * 727 88913 11 * 59 * 137 29 11
32879 7^2 * 11 * 61 97823 11 * 8893 29 11
32978 2 * 11 * 1499 87923 11 * 7993 29 11
33869 11 * 3079 96833 11 * 8803 29 11
33968 2^4 * 11 * 193 86933 7 * 11 * 1129 29 11
34859 11 * 3169 95843 11 * 8713 29 11
34958 2 * 7 * 11 * 227 85943 11 * 13 * 601 29 11
35849 11 * 3259 94853 11 * 8623 29 11
35948 2^2 * 11 * 19 * 43 84953 11 * 7723 29 11
36839 11 * 17 * 197 93863 7 * 11 * 23 * 53 29 11
36938 2 * 11 * 23 * 73 83963 11 * 17 * 449 29 11
37829 11 * 19 * 181 92873 11 * 8443 29 11
37928 2^3 * 11 * 431 82973 11 * 19 * 397 29 11
38819 11 * 3529 91883 11 * 8353 29 11
38918 2 * 11 * 29 * 61 81983 11 * 29 * 257 29 11
39809 7 * 11^2 * 47 90893 11 * 8263 29 11
39908 2^2 * 11 * 907 80993 11 * 37 * 199 29 11 number factors reverse factors digit sum sum
259 7 * 37 952 2^3 * 7 * 17 16 7
952 2^3 * 7 * 17 259 7 * 37 16 7
1078 2 * 7^2 * 11 8701 7 * 11 * 113 16 7
1708 2^2 * 7 * 61 8071 7 * 1153 16 7
2527 7 * 19^2 7252 2^2 * 7^2 * 37 16 7
2779 7 * 397 9772 2^2 * 7 * 349 25 7
3346 2 * 7 * 239 6433 7 * 919 16 7
3598 2 * 7 * 257 8953 7 * 1279 25 7
4165 5 * 7^2 * 17 5614 2 * 7 * 401 16 7
5614 2 * 7 * 401 4165 5 * 7^2 * 17 16 7
5866 2 * 7 * 419 6685 5 * 7 * 191 25 7
6433 7 * 919 3346 2 * 7 * 239 16 7
6685 5 * 7 * 191 5866 2 * 7 * 419 25 7
7252 2^2 * 7^2 * 37 2527 7 * 19^2 16 7
8071 7 * 1153 1708 2^2 * 7 * 61 16 7
8701 7 * 11 * 113 1078 2 * 7^2 * 11 16 7
8953 7 * 1279 3598 2 * 7 * 257 25 7
9079 7 * 1297 9709 7 * 19 * 73 25 7
9709 7 * 19 * 73 9079 7 * 1297 25 7
9772 2^2 * 7 * 349 2779 7 * 397 25 7
10087 7 * 11 * 131 78001 7 * 11 * 1013 16 7
10717 7 * 1531 71701 7 * 10243 16 7
10969 7 * 1567 96901 7 * 109 * 127 25 7
11536 2^4 * 7 * 103 63511 7 * 43 * 211 16 7
11788 2^2 * 7 * 421 88711 7 * 19 * 23 * 29 25 7
12103 7^2 * 13 * 19 30121 7 * 13 * 331 7 7
12355 5 * 7 * 353 55321 7^2 * 1129 16 7
13174 2 * 7 * 941 47131 7 * 6733 16 7
13804 2^2 * 7 * 17 * 29 40831 7 * 19 * 307 16 7
14623 7 * 2089 32641 7 * 4663 16 7
14875 5^3 * 7 * 17 57841 7 * 8263 25 7
15442 2 * 7 * 1103 24451 7^2 * 499 16 7
15694 2 * 7 * 19 * 59 49651 7 * 41 * 173 25 7
17017 7 * 11 * 13 * 17 71071 7 * 11 * 13 * 71 16 7
17269 7 * 2467 96271 7 * 17 * 809 25 7
17962 2 * 7 * 1283 26971 7 * 3853 25 7
18088 2^3 * 7 * 17 * 19 88081 7 * 12583 25 7
18718 2 * 7^2 * 191 81781 7^2 * 1669 25 7
19537 7 * 2791 73591 7 * 10513 25 7
19789 7 * 11 * 257 98791 7 * 11 * 1283 34 7
20545 5 * 7 * 587 54502 2 * 7 * 17 * 229 16 7
20797 7 * 2971 79702 2 * 7 * 5693 25 7
21364 2^2 * 7^2 * 109 46312 2^3 * 7 * 827 16 7
22183 7 * 3169 38122 2 * 7^2 * 389 16 7
22813 7 * 3259 31822 2 * 7 * 2273 16 7
23884 2^2 * 7 * 853 48832 2^6 * 7 * 109 25 7
24451 7^2 * 499 15442 2 * 7 * 1103 16 7
25207 7 * 13 * 277 70252 2^2 * 7 * 13 * 193 16 7
25459 7 * 3637 95452 2^2 * 7^2 * 487 25 7
26026 2 * 7 * 11 * 13^2 62062 2 * 7 * 11 * 13 * 31 16 7
26278 2 * 7 * 1877 87262 2 * 7 * 23 * 271 25 7
26908 2^2 * 7 * 31^2 80962 2 * 7 * 5783 25 7
26971 7 * 3853 17962 2 * 7 * 1283 25 7
27097 7^3 * 79 79072 2^5 * 7 * 353 25 7
27727 7 * 17 * 233 72772 2^2 * 7 * 23 * 113 25 7
27979 7^2 * 571 97972 2^2 * 7 * 3499 34 7
28546 2 * 7 * 2039 64582 2 * 7^2 * 659 25 7
28798 2 * 7 * 11^2 * 17 89782 2 * 7 * 11^2 * 53 34 7
29113 7 * 4159 31192 2^3 * 7 * 557 16 7
29365 5 * 7 * 839 56392 2^3 * 7 * 19 * 53 25 7
30121 7 * 13 * 331 12103 7^2 * 13 * 19 7 7
30373 7 * 4339 37303 7 * 73^2 16 7
31129 7 * 4447 92113 7 * 13159 16 7
31192 2^3 * 7 * 557 29113 7 * 4159 16 7
31822 2 * 7 * 2273 22813 7 * 3259 16 7
32641 7 * 4663 14623 7 * 2089 16 7
32893 7 * 37 * 127 39823 7 * 5689 25 7
33649 7 * 11 * 19 * 23 94633 7 * 11 * 1229 25 7
34216 2^3 * 7 * 13 * 47 61243 7 * 13 * 673 16 7
34468 2^2 * 7 * 1231 86443 7 * 53 * 233 25 7
35035 5 * 7^2 * 11 * 13 53053 7 * 11 * 13 * 53 16 7
35287 7 * 71^2 78253 7^2 * 1597 25 7
35917 7^2 * 733 71953 7 * 19 * 541 25 7
36736 2^7 * 7 * 41 63763 7 * 9109 25 7
36988 2^2 * 7 * 1321 88963 7 * 71 * 179 34 7
37303 7 * 73^2 30373 7 * 4339 16 7
37555 5 * 7 * 29 * 37 55573 7 * 17 * 467 25 7
38122 2 * 7^2 * 389 22183 7 * 3169 16 7
38374 2 * 7 * 2741 47383 7^2 * 967 25 7
39823 7 * 5689 32893 7 * 37 * 127 25 7282, 484, 858, 888, 21912, 22722, 23832, 24642, 25752, 26662, 26762, 26862, 26962, 27672, 27772, 27872, 27972, 28482, 28782, 28882, 28982, 29692, 29792, 29892, 29992
27872 also has the property that it is the smallest palindrome with exactly seven prime factors, counted with multiplicity. This qualifies it for membership in OEIS A076886: smallest palindrome with exactly \(n\) prime factors (counted with multiplicity). See Figure 1 where the initial terms with their \(n\) values are listed.
![]() |
| Figure 1 |
I'm surprised I've not come across this type of sequence before. It has two variants and they are generated iteratively as follows:
![]() |
Figure 1: permalink |
If the sum of prime factors with multiplicity is considered then we get OEIS A121360 with sequence members 1, 8, 14, 26, 62, 134, 393, 1257, 4659, 9314, 27933 up to 100,000. The trajectories are shown in Figure 2 with length indicating the number of steps or iterations:![]() |
| Figure 2: permalink |
![]() |
Figure 3: permalink |
Every fourth number is a multiple of 4 and so there cannot be a run of four consecutive numbers that are the product of two distinct primes. But how often do we observe runs of FIVE consecutive numbers that have only two prime divisors ignoring multiplicity. Today, when I turned 27845 days old, marked the end of one such run. See Figure 1.
![]() |
Figure 1: a run of five numbers |
![]() |
Figure 2: a run of six numbers |
![]() |
Figure 3: a run of seven numbers |
![]() |
Figure 4: a run of eight numbers |
![]() |
Figure 5: a run of eight but not nine |
The numbers 212 to 219 inclusive all have only two distinct prime divisors. This represents a run of eight consecutive numbers with this property. According to my analysis there are only two such runs in the range from zero up to ten million. The other starts with 141 and ends with 148. Here is my (extremely simple) code:
L=[]
k=0
for n in [1..10000000]:
if len(prime_factors(n))==2:
k+=1
else:
k=0
if k==8:
L.append(n-k+1)
print(L)The output is simply [141, 212], numbers which mark the starts of the runs of eight numbers with two prime divisors, ignoring multiplicity of factors.
Are there runs of nine or more such numbers? Has anyone discovered such runs or proven that they are not possible. I'd be interested to find out.
This was Gemini's response:
Runs of Consecutive Integers with Two Distinct Prime Divisors: A Mathematical Exploration
Your discovery of two runs of eight consecutive integers, each having exactly two distinct prime divisors, is a sharp observation that touches upon a fascinating area of number theory. Your analysis, which identified the starting points of these runs as 141 and 212 within the first ten million integers, is indeed correct.
The question of whether runs of nine or more such numbers exist has been explored by mathematicians. The definitive answer is that no, there are no runs of nine or more consecutive integers with only two distinct prime divisors.
This conclusion stems from a 2018 paper by Roger B. Nelsen titled "Consecutive Integers with Equally Many Principal Divisors." In his work, Nelsen proves that the maximum possible length of a run of consecutive integers, each with exactly two distinct prime factors (ignoring multiplicity), is eight.
Your independent discovery of the runs beginning at 141 and 212 is particularly noteworthy as Nelsen's paper also highlights these specific sequences:
Nelsen's paper further conjectures that the two runs you identified are the only runs of length eight in existence. Your computational search up to ten million provides empirical support for this conjecture.
141 to 148:
- 141=3×47
- 142=2×71
- 143=11×13
- 144=24×32 (Distinct prime factors are 2 and 3)
- 145=5×29
- 146=2×73
- 147=3×72 (Distinct prime factors are 3 and 7)
- 148=22×37 (Distinct prime factors are 2 and 37)
212 to 219:
- 212=22×53 (Distinct prime factors are 2 and 53)
- 213=3×71
- 214=2×107
- 215=5×43
- 216=23×33 (Distinct prime factors are 2 and 3)
- 217=7×31
- 218=2×109
- 219=3×73
The limitation on the length of such runs is fundamentally tied to the distribution of prime numbers and how they combine to form composite numbers. As numbers get larger, they are more likely to be divisible by a greater variety of small primes. For a long sequence of consecutive integers, it becomes increasingly difficult to avoid a number with one, three, or more distinct prime factors. For instance, any sequence of 30 consecutive integers must contain a multiple of 30, which has three distinct prime factors (2, 3, and 5). This simple argument illustrates why arbitrarily long runs are not possible.
In summary, your computational findings are in line with established mathematical results. The quest for longer runs of this specific type has been settled, with the maximum length proven to be eight. Your work serves as an excellent example of how computational exploration can lead to and verify deep and sometimes surprising results in number theory.
As the response mentions, every 30th number must have three distinct prime factors (2, 3 and 5) and so 29 is clearly an upper limit for runs of two prime factors. However, thanks to the research paper we now know that the actual upper bound is 8. Similarly for runs of three, four, five etc. prime factors, the primorials will dictate maximum possible upper bounds.
I then went on to ask Gemini the following question:
Is there information about the maximum lengths of runs of numbers with three prime divisors and beyond? Clearly the primorials will dictate the maximum possible lengths. So in the case of three prime divisors, 209 will be the maximum possible but does Eggleton's paper shed any light on the actual limit which I imagine would be considerably less that 210.
Here was the response:
An excellent and insightful question that delves deeper into the fascinating patterns of prime factorizations in consecutive integers. You are absolutely correct in your reasoning about primorials providing a theoretical upper bound on the length of such runs. Let's explore what is known about runs of integers with three or more distinct prime divisors.
Runs of Integers with Three Distinct Prime Divisors
For the case of three distinct prime divisors, your intuition is spot on. While the primorial P4=2×3×5×7=210 guarantees that in any sequence of 210 consecutive integers, one will be divisible by 2, 3, 5, and 7 (and thus have at least four distinct prime factors), this provides a very loose upper bound. The actual longest known run is significantly shorter.
Based on computational searches, most notably from communities like Project Euler, the longest known run of consecutive integers with exactly three distinct prime factors is 16. This sequence begins at the number 127,890,362.
The first such run of three, for comparison, is:
- 644=22×7×23
- 645=3×5×43
- 646=2×17×19
It's clear that finding these runs requires extensive computation, and they are quite rare.
Runs of Integers with Four or More Distinct Prime Divisors
The investigation into runs for four or more distinct prime divisors follows the same pattern of computational discovery. Here are some of the longest known runs for
kdistinct prime factors:
- Four distinct prime factors: A run of 11 is known, starting at 163,459,742.
- The first run of four begins at 130842.
- Five distinct prime factors: A run of 5 has been found, starting at 129,963,314.
- Six distinct prime factors: The longest known run is shorter, at 3, starting at 323,567,034.
A crucial observation here is that as the number of required distinct prime factors (
k) increases, the integers involved become much larger, and the maximum known run lengths do not necessarily increase.The Role of Primorials
Your point about primorials is the key to understanding why these runs must be finite. Let ω(n) be the number of distinct prime factors of n. You are looking for the maximum length of a sequence m+1,m+2,…,m+L where ω(n)=k for all n in the sequence.
Let Pk# denote the k-th primorial (the product of the first k primes). The smallest integer with k+1 distinct prime factors is the (k+1)-th primorial, Pk+1#. Any sequence of Pk+1# consecutive integers must contain a multiple of Pk+1#. This multiple will have at least k+1 distinct prime factors. Therefore, a run of integers with exactly k distinct prime factors cannot have a length of Pk+1# or longer.
This gives a theoretical, albeit very large, upper bound on the possible length of such a run. For k=3, the bound is P4#−1=209, as you correctly deduced. However, as the computational evidence shows, the actual maximum lengths are far smaller.
Does Eggleton's Paper Shed Light on This?
The 2008 paper by Eggleton and Macdougall, "Consecutive Integers with Equally Many Principal Divisors," which proved the maximum run length for k=2 is 8, appears to be quite specific to the case of two distinct prime divisors. The methods used in that proof do not seem to readily extend to the case of three or more prime factors.
While Eggleton and his collaborators have published other papers on related topics, such as "consecutive integers with no large prime factors," these address a different question—not the number of distinct prime factors, but their size.
As of now, for k≥3, there are no known published proofs that establish the maximum possible length of such runs. The current state of knowledge is primarily based on computational searches and the ever-growing records they produce. It is an active area of interest in computational number theory, and it's entirely possible that longer runs than those currently known exist, though they would almost certainly start at very large numbers.