Showing posts with label prime factors. Show all posts
Showing posts with label prime factors. Show all posts

Thursday, 17 September 2026

Supercharged Semiprimes

 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

28291 is an example of such a semiprime. Let's examine its properties where || represents concatenation:$$ \begin{align} 28291 &=19 \times 1489\\ 19 \, || \, 1489 &= 191489 \\ &= 53 \times 3613 \\ 1489 \, || \,19  &=148919 \\ &= 137 \times 1087 \\ 19 &\rightarrow 91 \\&=7 \times 13 \\1489 &\rightarrow 1894 \\ &= 2 \times 947 \end{align}$$Up to 40000, the semiprimes that meet both criteria are (permalink):

779, 817, 1121, 1763, 1957, 2071, 2869, 3173, 3403, 3629, 4579, 4687, 4897, 5149, 5977, 6973, 7009, 7181, 7261, 7367, 7493, 8077, 8341, 8413, 8549, 8851, 8977, 9071, 9937, 10123, 10363, 10393, 10679, 10697, 10951, 11051, 11419, 11647, 12407, 12599, 13207, 14317, 14473, 14719, 14809, 14953, 15007, 15143, 15529, 15637, 15751, 16283, 16297, 16321, 16351, 16789, 16873, 17671, 18391, 18563, 18643, 19177, 19247, 19451, 20081, 20311, 20653, 20729, 20989, 21071, 21223, 21733, 21829, 21887, 21971, 22313, 22361, 22489, 22819, 22837, 22879, 22987, 23083, 23351, 23521, 24257, 24377, 24559, 24751, 24757, 24823, 25061, 25843, 25901, 26179, 26239, 26617, 26671, 26969, 27089, 27161, 27199, 27331, 27383, 27589, 27913, 28177, 28291, 28801, 28907, 28937, 28999, 29149, 29329, 29621, 30301, 30571, 30847, 31111, 31921, 32101, 32239, 32293, 32387, 32651, 32699, 33307, 33907, 33991, 34093, 34571, 34579, 34633, 34873, 34927, 35137, 35209, 35341, 35389, 35587, 35701, 35881, 36031, 36199, 36689, 37069, 37127, 37867, 37901, 38021, 38141, 38173, 38323, 38477, 38497, 38989, 39187, 39433, 39707, 39757

Tuesday, 15 September 2026

Fermat Numbers

A Fermat number, named after Pierre de Fermat (1601–1665), the first known to have studied them, is a positive integer of the form: $$ \text{F}_n=2^{2^n}+1 $$ where n is a non-negative integer. The first few Fermat numbers are:
  • \(\text{F}_0=3\)
  • \(\text{F}_1=5\)
  • \(\text{F}_2=17 \)
  • \(\text{F}_3=257\)
  • \(\text{F}_4=65537\)
  • \(\text{F}_5=4294967297\)
  • \(\text{F}_6=18446744073709551617\)
  • \(\text{F}_7=340282366920938463463374607431768211457\)
The numbers form the initial members of sequence A000215 in the OEIS. The only known Fermat primes are the first five members of this sequence (3, 5, 17, 257 and 65537).

The number associated with my diurnal age today, \( \textbf{28289}\), is a prime and oddly it has a connection to these Fermat numbers via its membership in OEIS A229856:


   A229856: primes of the form \(384 \times k + 257\) where \(k \geq 0\)


The initial members are:

257, 641, 1409, 3329, 4481, 7937, 9473, 9857, 11393, 11777, 12161, 13313, 13697, 14081, 15233, 16001, 17921, 19073, 19457, 19841, 21377, 23297, 25601, 28289, 30593, 30977, 35201, 35969, 36353, 37889, 38273, 39041

It's stated in the comments to this OEIS sequence that:
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.

Wednesday, 19 August 2026

Super Sphenic Numbers

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.

Saturday, 23 May 2026

Smith Number Subsets

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:


A176670
: composite numbers having the same digits as their prime factors (with multiplicity), excluding zero digits.

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      31

What's interesting is that these same digits show up several times in the above table:

  • 17482 which is a permutation of the digits of 28174
  • 149782 which has the digit 9 added to the permuted digits
  • 174082 which has the digit 0 added to the permuted digits
  • 174298 which has the digit 9 added to the permuted digits
  • 174982 which has the digit 9 added to the permuted digits
  • 208174 which has the digit 0 inserted after the 2 in 28174

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

Thursday, 5 February 2026

Why Is 313131 An Interesting Number?


Recently a friend of mine who was staying at a hotel revealed that the six digit security code for the room was 313131. This looked like an easy code to crack and I was reminded of a post that I'd made recently titled Passcodes and Repeated Digits in November of 2025. Figure 1 shows the probabilities for the number of distinct digits chosen:


Figure 1

So the code 313131 is indeed easy to crack, requiring only a maximum of 62 attempts or 31 attempts on average. However, what was of most interest to me regarding 313131 was its prime factorisation:$$ 313131=3 \times 7 \times 13 \times 31 \times 37$$If we rearrange the order of multiplication we get the following:$$ 313131=7 \times 3 \times 13 \times 31 \times 37$$Concatenating these digits we get the number \(73133137\) which is palindromic.

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

I've incorporated this algorithm into my daily search program that has become somewhat impressive if I do say so myself. See Figure 3 for the results of 28067, my diurnal age today.


Figure 3

The output is generated by the same program but I've just restricted the range to my daily number, rather lazy but it does the job. Remember the prime factorisation takes multiplicity into account. For completeness I'll include the Python code:

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))

Saturday, 25 October 2025

Prime Factor Fibonacci

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.

Saturday, 20 September 2025

Seven Eleven Rules

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 is divisible by 11
  • its reverse is also divisible by 11
  • its sum of digits gives a number whose digits sum to 11
It turns out that there are only 30 numbers that satisfy these criteria in the range up to 40000. They are:

20999, 21989, 22979, 23969, 24959, 25949, 26939, 27929, 28919, 29909, 30899, 30998, 31889, 31988, 32879, 32978, 33869, 33968, 34859, 34958, 35849, 35948, 36839, 36938, 37829, 37928, 38819, 38918, 39809, 39908

The details are (permalink):

  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


The algorithm can be modified to search for prime numbers other than 11. For example, there are 80 numbers in the range up to 40000 that satisfy these criteria:
  • number is divisible by 7
  • its reverse is also divisible by 7
  • its sum of digits gives a number whose digits sum to 7
These numbers are (permalink):

259, 952, 1078, 1708, 2527, 2779, 3346, 3598, 4165, 5614, 5866, 6433, 6685, 7252, 8071, 8701, 8953, 9079, 9709, 9772, 10087, 10717, 10969, 11536, 11788, 12103, 12355, 13174, 13804, 14623, 14875, 15442, 15694, 17017, 17269, 17962, 18088, 18718, 19537, 19789, 20545, 20797, 21364, 22183, 22813, 23884, 24451, 25207, 25459, 26026, 26278, 26908, 26971, 27097, 27727, 27979, 28546, 28798, 29113, 29365, 30121, 30373, 31129, 31192, 31822, 32641, 32893, 33649, 34216, 34468, 35035, 35287, 35917, 36736, 36988, 37303, 37555, 38122, 38374, 39823

The details are (permalink):

  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          7

Friday, 25 July 2025

27872: Another Palindromic Number


For the last 800 days they've been coming around every 100 days and today marks yet another palindromic day as I turn 27872 days old. I've mentioned one of the properties of this number in my post titled Difference of Two Cubic Numbers. I noted that this palindrome is a difference of two cubes:$$27872=38^3-30^3$$Another property of this palindrome is that it is the sum of two prime palindromes in two different ways:$$ \begin{align} 27872 &= 11311 + 16561\\ &=12421 + 15451 \end{align}$$In the range up to 40000, there are only 25 palindromes with this property and these are the initial terms of OEIS A356854:

282, 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

In 100 days I'll be able to celebrate 27972 that's also a member of OEIS A356854. After that, it is only 31 days to the next palindromic day: 30003.

Wednesday, 2 July 2025

Prime Factor Sequences

I'm surprised I've not come across this type of sequence before. It has two variants and they are generated iteratively as follows:

  • number --> sum of prime factors without multiplicity
    For example, 24 with factors of 2 and 3 gives 5 and terminates after just one step

  • number --> sum of prime factors with multiplicity
    For example, 24 with factors of 2, 2, 2 and 3 gives 11 and terminates after just one step
Larger numbers of course take more than one step to terminate and it's of interest to consider those numbers that set records in term of trajectory lengths. In this context, let's consider OEIS A047830.


A047830  least number which becomes prime after exactly \(n\) iterations of f(\(x\)) = sum of prime factors of \(x\).


The members of this sequence are 4, 14, 26, 62, 134, 393, 1774, 13682, 41037 up to 100,000. The trajectories are shown in Figure 1 with length indicating the number of steps or iterations:


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

The algorithms used to find the trajectories of record lengths can be easily modified to find numbers with trajectories of a specified length (number of steps or iterations). For example, how many numbers in the range up to 40000 require eight steps to reach a prime under the sum of prime factors without multiplicity algorithm. Here are the numbers (with 13682 being the first as we know already from Figure 1):

13682, 18002, 19137, 22934, 24014, 24787, 27364, 27849, 30062, 30993, 32577, 33477, 35410, 35798, 36004, 36398, 36706, 39206

These numbers are the initial members of OEIS A047827. Figure 3 shows the details of their trajectories:


Figure 3: permalink

Saturday, 28 June 2025

A Novel Number Run

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

So 27841 marked the start of the sequence of five consecutive numbers, each of has only two prime divisors ignoring multiplicity:
  • 27841 has prime divisors of 11 and 2531
  • 27842 has prime divisors of 2 and 13921
  • 27843 has prime divisors of 3 and 9281
  • 27844 has prime divisors of 2 and 6961
  • 27845 has prime divisors of 5 and 5569
 How many other numbers in the range up to 40000 mark the start of a similar sequence. It turns out that there are 67 such numbers (permalink).

54, 91, 115, 141, 158, 205, 212, 295, 301, 323, 391, 535, 685, 721, 799, 1135, 1345, 1465, 1535, 1711, 1941, 1981, 2101, 2215, 2302, 2425, 2641, 3865, 4411, 5461, 6505, 6625, 6925, 7165, 7231, 7261, 7441, 7855, 7891, 8575, 9121, 9355, 9571, 10081, 10375, 11755, 11851, 13435, 13951, 14371, 15115, 16291, 17635, 18805, 20575, 20665, 24575, 24865, 25291, 27841, 30373, 31285, 32125, 35821, 36961, 38941, 39391

These numbers make up OEIS A383400

What about runs of six such numbers? There are only five numbers and they are 91, 141, 212, 323 and 2302. See Figure 2 where 91 is used as an example:


Figure 2: a run of six numbers

Let's investigate runs of seven such numbers. Here we find 91 drops out because 97 is prime but 141, 212, 323 and 2302 remain. Figure 3 shows 141 as the example.


Figure 3: a run of seven numbers

For runs of eight such numbers only 141 and 212 remain. Figure 4 shows the results using 141 again.


Figure 4: a run of eight numbers

149 is prime so that's the end of 141 but what about 212? Unfortunately, it doesn't make it either as Figure 5 shows.


Figure 5: a run of eight but not nine

Even extending the range to TEN million, no suitable numbers are found. Just the fact that I can use SageMath on my M1 Macbook Air to factorise ten million numbers is pretty amazing. Are there runs of nine consecutive numbers? I didn't know so I put the following question to Google's Gemini:

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:

  • 141 to 148:

    • (Distinct prime factors are 2 and 3)
    • (Distinct prime factors are 3 and 7)
    • (Distinct prime factors are 2 and 37)
  • 212 to 219:

    • (Distinct prime factors are 2 and 53)
    • (Distinct prime factors are 2 and 3)
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.

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 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:

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 k distinct 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 where for all n in the sequence.

Let Pk# denote the k-th primorial (the product of the first k primes). The smallest integer with distinct prime factors is the -th primorial, Pk+1#. Any sequence of Pk+1# consecutive integers must contain a multiple of Pk+1#. This multiple will have at least 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 , the bound is , 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 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 , 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.