Saturday, 24 May 2025

A + B = C

In the range up to, let's say 40000, how many numbers \(c\) are there such that:$$a+b=c$$where \(a\), \(b\) and \(c\) contain the same decimal digits. I got Gemini to write some Python code in order to identify these numbers. I knew that the number associated with my diurnal age today, \( \textbf{27810} \), was one such number since it belongs to OEIS A203024. The code is shown at the end of this post.

The code outputs the following numbers up to 40000:

954, 2961, 4932, 5013, 5022, 5031, 5238, 5823, 6147, 6417, 7614, 7641, 8235, 8523, 9045, 9108, 9180, 9324, 9504, 9540, 9594, 9612, 9684, 9774, 9864, 9954, 20961, 21150, 21501, 24831, 24921, 25011, 26901, 27810, 28107, 28314, 29016, 29214, 29610, 29691, 29961, 30168, 30186, 31077, 31257, 31275, 31482, 31824, 32148, 32184, 32481, 32814, 34182, 34218, 34281, 34812, 35127, 35712, 36819, 37125, 37512, 38124, 38142, 38241, 38421, 38619

Here is a table showing the details for each number:

-----------------------------------
c (n)      | a (b)      | b (n-b)   
-----------------------------------
954        | 459        | 495       
2961       | 1269       | 1692      
4932       | 2439       | 2493      
5013       | 1503       | 3510      
5022       | 2502       | 2520      
5031       | 1530       | 3501      
5238       | 2385       | 2853      
5823       | 2538       | 3285      
6147       | 1476       | 4671      
6417       | 1746       | 4671      
7614       | 1467       | 6147      
7641       | 1467       | 6174      
8235       | 2853       | 5382      
8523       | 3285       | 5238      
9045       | 4095       | 4950      
9108       | 1089       | 8019      
9180       | 1089       | 8091      
9324       | 4392       | 4932      
9504       | 4095       | 5409      
9540       | 4590       | 4950      
9594       | 4599       | 4995      
9612       | 2691       | 6921      
9684       | 4698       | 4986      
9774       | 4797       | 4977      
9864       | 4896       | 4968      
9954       | 4959       | 4995      
20961      | 10269      | 10692     
21150      | 10125      | 11025     
21501      | 10251      | 11250     
24831      | 12348      | 12483     
24921      | 12429      | 12492     
25011      | 12501      | 12510     
26901      | 10692      | 16209     
27810      | 10728      | 17082     
28107      | 10287      | 17820     
28314      | 13482      | 14832     
29016      | 12096      | 16920     
29214      | 14292      | 14922     
29610      | 12690      | 16920     
29691      | 12699      | 16992     
29961      | 12969      | 16992     
30168      | 13860      | 16308     
30186      | 13806      | 16380     
31077      | 13707      | 17370     
31257      | 13725      | 17532     
31275      | 13752      | 17523     
31482      | 13248      | 18234     
31824      | 13482      | 18342     
32148      | 13824      | 18324     
32184      | 13842      | 18342     
32481      | 14238      | 18243     
32814      | 14382      | 18432     
34182      | 12348      | 21834     
34218      | 12384      | 21834     
34281      | 12438      | 21843     
34812      | 13428      | 21384     
35127      | 13752      | 21375     
35712      | 12537      | 23175     
36819      | 16983      | 19836     
37125      | 15372      | 21753     
37512      | 12375      | 25137     
38124      | 14283      | 23841     
38142      | 13824      | 24318     
38241      | 13428      | 24813     
38421      | 14238      | 24183     
38619      | 18936      | 19683     
-----------------------------------

Total numbers found: 66

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

def
find_permutation_sums_up_to(limit):
    """
    Finds all numbers 'n' up to a given limit that can be expressed as the sum
    of two numbers 'b' and 'n-b', where n, b, and n-b are permutations of
    each other's digits. Displays the results in a tabular format and
    a comma-separated list of 'c' numbers.
    """
    found_c_numbers = [] # To store only the 'c' values
    print(f"Searching for permutation sums up to {limit}...")
    print("-" * 35)
    print(f"{'c (n)':<10} | {'a (b)':<10} | {'b (n-b)':<10}")
    print("-" * 35)
    for n in range(1, limit + 1):
        s_n = sorted(str(n))
        min_b = int("".join(s_n))
        # Optimization: If min_b is greater than n, no permutation of n's digits
        # can be smaller than n, so no valid 'b' can be formed.
        if min_b > n:
            continue
        for b in range(max(1, min_b), n // 2 + 1):
            s_b = sorted(str(b))
            s_n_minus_b = sorted(str(n - b))
            if s_b == s_n and s_n_minus_b == s_n:
                found_c_numbers.append(n) # Add 'c' to the list
                print(f"{n:<10} | {b:<10} | {n - b:<10}")
                break  # Found a pair for 'n', move to the next 'n'
    print("-" * 35)
    print(f"\nTotal numbers found: {len(found_c_numbers)}")
    # Display the comma-separated list of 'c' numbers
    if found_c_numbers:
        print("\nComma-separated list of 'c' numbers:")
        print(", ".join(map(str, found_c_numbers)))
    else:
        print("\nNo 'c' numbers found within the specified limit.")
# Run the search up to 40000
find_permutation_sums_up_to(40000)  
 

Comments on Code:

found_c_numbers = []: A new list is introduced at the beginning of the function to store just the n (or c) values that satisfy the condition. 
 
found_c_numbers.append(n): Inside the if block where a valid triplet is found, n is appended to this new list. 
 
Printing the Comma-Separated List:
After the main for loop finishes, an if found_c_numbers: check ensures that we only try to print if there are numbers to print.
print(", ".join(map(str, found_c_numbers))):
map(str, found_c_numbers) converts each integer in the found_c_numbers list to a string.
", ".join(...) then concatenates these strings with a comma and space in between, creating the desired comma-separated list.
An else block is added to inform the user if no numbers were found. 
 
Minor Optimization:
Added if min_b > n: continue inside the main loop. This is a small optimization. If the smallest number that can be formed from n's digits is greater than n itself, then b (which must be a permutation of n's digits) can't be n or smaller, making it impossible for b and n-b to also be permutations of n. This happens for numbers like 10 where min_b would be 1. While b does not necessarily have to be exactly a permutation of n, this check ensures that b is at least within the range of numbers that n's digits can form. This is particularly relevant when n starts with zeros, e.g., for n=01 (which is 1), min_b would be 1. However, str(n) correctly handles this by giving "1", so min_b would correctly be 1. This optimization is generally more critical in other permutation problems, but it doesn't hurt here.

Wednesday, 21 May 2025

First Fours, Threes and Twos of a Kind

The first thing we notice about \( \textbf{27807}\) is its factorisation:$$27807 = 3 \times 13 \times 23 \times 31$$This number has four distinct prime factors and all of them contain the digit 3. The number indicates my diurnal age today. How often does this occur (that a number has four distinct prime factors and all of them contain the digit 3). Well, 27807 is the first such number. Here is the list of numbers with this property up to 100,000: 27807, 33189, 38571, 44733, 47541, 51987, 62049, 64077, 65481, 74451, 76479, 79143, 88257, 88881, 91977, 92391. Table 1 shows these numbers together with their factorisations.


Table 1

A natural question to ask is what about other digits? In the range up to 100,000, there are only four numbers with four distinct prime factors all of which contain the digit 1. These are 46189, 75361, 84227 and 99671. Table 2 shows these numbers together with their factorisations.


Table 2

Apart from the digits 1 and 3, there are no other numbers in the range up to 100,000 with four distinct prime factors each of which contain the same digit. Such numbers exist of course but they are larger than 100,000. Table 3 shows the results for all the digits from 0 to 9.

Table 3: permalink

Thus we see that 27807 is unique in that it is the smallest number with four distinct prime factors such that each factor contains the same digit at least once. I'm pleased that I spotted this as it is easy to miss. We can construct a similar table for sphenic numbers as can be seen in Table 4 where the fourth factor appearing in Table 3 is omitted.


Table 4: permalink

So we see that 897 is the smallest sphenic number whose three distinct factors contain the same digit at least once. While we're here we may as well show the results for semiprimes with two distinct prime factors as well. See Table 5.

Table 5: permalink

Thus 39 is the smallest semiprime with two distinct prime factors such that each factor contains the same digit at least once. If we didn't specify distinct prime factors then 4 = 2 x 2 would win out.

Tuesday, 20 May 2025

Revisiting Reverse and Add

Numbers \(n\) belonging to OEIS A063048 have the property that the Reverse and Add! trajectory of \(n\) (presumably) does not reach a palindrome and does not join the trajectory of any term \(m < n\). Up to 40,000 these numbers are:

196, 879, 1997, 7059, 10553, 10563, 10577, 10583, 10585, 10638, 10663, 10668, 10697, 10715, 10728, 10735, 10746, 10748, 10783, 10785, 10787, 10788, 10877, 10883, 10963, 10965, 10969, 10977, 10983, 10985, 12797, 12898, 13097, 13197, 13694, 14096, 14698, 15297, 15597, 18598, 18798, 19098, 20459, 30389, 30399, 30929, 30959, 30979

Now there are many more numbers that presumably do not reach a palindrome but they join the trajectories of the above numbers at some point and thus do not fulfil the \(m<n\) condition. These numbers belong to OEIS A023108: positive integers which apparently never result in a palindrome under repeated applications of the function A056964(\(x\)) = \(x\) + (\(x\) with digits reversed). 

\( \textbf{27806} \), my diurnal age today, is one such number. I tested it for 30,000 iterations and still no palindrome was found. Now 39996 is the 1750th member of the sequence and so these numbers represent 4.375% of the total numbers in the range. Some numbers coming up soon are 27812,  27837,  27847,  27866,  27896,  27906,  27912,  27914,  27956,  27964 and 27988. Between 27806 and 40,000 these numbers (which include all those in OEIS A063048) are:

27806,  27812,  27837,  27847,  27866,  27896,  27906,  27912,  27914,  27956,  27964,  27988,  28036,  28046,  28055,  28056,  28095,  28096,  28146,  28156,  28193,  28236,  28256,  28266,  28281,  28286,  28332,  28341,  28342,  28346,  28356,  28362,  28369,  28469,  28487,  28496,  28502,  28504,  28545,  28546,  28566,  28576,  28586,  28595,  28596,  28597,  28616,  28643,  28657,  28686,  28696,  28702,  28704,  28706,  28707,  28732,  28736,  28776,  28796,  28797,  28802,  28827,  28837,  28856,  28886,  28896,  28902,  28904,  28946,  28954,  28978,  29026,  29036,  29045,  29046,  29085,  29086,  29097,  29136,  29146,  29183,  29226,  29246,  29256,  29271,  29276,  29322,  29331,  29332,  29336,  29346,  29352,  29359,  29396,  29459,  29477,  29486,  29494,  29499,  29535,  29536,  29556,  29566,  29576,  29585,  29586,  29587,  29590,  29606,  29633,  29647,  29676,  29686,  29722,  29726,  29766,  29786,  29787,  29791,  29796,  29817,  29827,  29846,  29876,  29886,  29899,  29936,  29944,  29968,  29997,  30089,  30358,  30389,  30399,  30439,  30458,  30479,  30489,  30536,  30551,  30561,  30575,  30581,  30583,  30636,  30651,  30661,  30666,  30695,  30713,  30726,  30733,  30744,  30746,  30781,  30783,  30785,  30786,  30841,  30849,  30875,  30881,  30889,  30929,  30931,  30959,  30961,  30963,  30967,  30975,  30979,  30981,  30983,  31079,  31348,  31379,  31389,  31429,  31448,  31469,  31479,  31526,  31541,  31551,  31565,  31571,  31573,  31626,  31641,  31651,  31656,  31685,  31703,  31716,  31723,  31734,  31736,  31771,  31773,  31775,  31776,  31831,  31839,  31865,  31871,  31879,  31896,  31919,  31921,  31949,  31951,  31953,  31957,  31965,  31969,  31971,  31973,  32069,  32095,  32295,  32338,  32369,  32379,  32391,  32419,  32438,  32459,  32469,  32516,  32531,  32541,  32555,  32561,  32563,  32616,  32631,  32641,  32646,  32675,  32706,  32713,  32724,  32726,  32761,  32763,  32765,  32766,  32791,  32795,  32821,  32829,  32855,  32861,  32869,  32886,  32896,  32909,  32911,  32939,  32941,  32943,  32947,  32955,  32959,  32961,  32963,  32999,  33059,  33085,  33095,  33195,  33285,  33328,  33359,  33369,  33381,  33390,  33391,  33395,  33409,  33428,  33449,  33459,  33499,  33506,  33521,  33531,  33545,  33551,  33553,  33594,  33595,  33606,  33621,  33631,  33636,  33665,  33692,  33703,  33714,  33716,  33751,  33753,  33755,  33756,  33781,  33785,  33811,  33819,  33845,  33851,  33859,  33876,  33886,  33901,  33929,  33931,  33937,  33945,  33949,  33951,  33953,  33989,  33995,  34049,  34075,  34085,  34094,  34095,  34185,  34195,  34275,  34295,  34318,  34349,  34359,  34371,  34380,  34381,  34385,  34395,  34418,  34439,  34449,  34489,  34511,  34521,  34535,  34541,  34584,  34585,  34611,  34621,  34626,  34655,  34682,  34696,  34704,  34706,  34741,  34745,  34746,  34771,  34775,  34801,  34809,  34835,  34841,  34849,  34866,  34876,  34895,  34899,  34919,  34921,  34923,  34927,  34935,  34939,  34941,  34979,  34985,  34993,  35039,  35065,  35075,  35084,  35085,  35175,  35185,  35265,  35285,  35295,  35308,  35339,  35349,  35361,  35370,  35371,  35375,  35385,  35391,  35398,  35408,  35429,  35439,  35479,  35498,  35501,  35511,  35525,  35531,  35533,  35574,  35575,  35595,  35601,  35611,  35616,  35645,  35672,  35686,  35731,  35733,  35735,  35736,  35761,  35765,  35825,  35831,  35839,  35856,  35866,  35885,  35889,  35909,  35911,  35913,  35917,  35925,  35929,  35931,  35933,  35969,  35975,  35983,  35999,  36029,  36055,  36065,  36074,  36075,  36165,  36175,  36255,  36275,  36285,  36329,  36339,  36351,  36360,  36361,  36365,  36375,  36381,  36388,  36419,  36429,  36469,  36488,  36501,  36515,  36521,  36523,  36564,  36565,  36585,  36595,  36601,  36606,  36635,  36662,  36676,  36721,  36723,  36725,  36726,  36751,  36755,  36795,  36815,  36821,  36829,  36846,  36856,  36875,  36879,  36901,  36903,  36907,  36915,  36919,  36921,  36923,  36959,  36965,  36973,  36989,  36997,  37019,  37045,  37055,  37064,  37065,  37155,  37165,  37245,  37265,  37275,  37290,  37295,  37319,  37329,  37341,  37350,  37351,  37355,  37365,  37371,  37378,  37409,  37419,  37459,  37478,  37496,  37499,  37505,  37511,  37513,  37554,  37555,  37575,  37585,  37595,  37625,  37652,  37666,  37695,  37711,  37713,  37715,  37716,  37741,  37745,  37785,  37805,  37811,  37819,  37836,  37846,  37865,  37869,  37895,  37905,  37909,  37911,  37913,  37949,  37955,  37963,  37979,  37987,  37999,  38009,  38035,  38045,  38054,  38055,  38094,  38095,  38099,  38145,  38155,  38192,  38235,  38255,  38265,  38280,  38285,  38309,  38319,  38331,  38340,  38341,  38345,  38355,  38361,  38368,  38399,  38409,  38449,  38468,  38486,  38489,  38495,  38499,  38501,  38503,  38544,  38545,  38565,  38575,  38585,  38594,  38595,  38596,  38615,  38642,  38656,  38685,  38695,  38701,  38703,  38705,  38706,  38731,  38735,  38775,  38795,  38796,  38801,  38809,  38826,  38836,  38855,  38859,  38885,  38895,  38899,  38901,  38903,  38939,  38945,  38953,  38969,  38977,  38989,  39025,  39035,  39044,  39045,  39084,  39085,  39089,  39096,  39135,  39145,  39182,  39225,  39245,  39255,  39270,  39275,  39309,  39321,  39330,  39331,  39335,  39345,  39351,  39358,  39389,  39395,  39439,  39458,  39476,  39479,  39485,  39489,  39498,  39534,  39535,  39555,  39565,  39575,  39584,  39585,  39586,  39605,  39632,  39646,  39675,  39685,  39721,  39725,  39765,  39785,  39786,  39790,  39791,  39795,  39816,  39826,  39845,  39849,  39875,  39885,  39889,  39891,  39898,  39929,  39935,  39943,  39959,  39967,  39979,  39996

Monday, 19 May 2025

The 17x + 1 Map Revisited

It's been a while, over seven years in fact since I last mentioned the 17\(x\) + 1 map in an eponymous post in March of 2018. As I explained back then:
Having recently written yet again about the Collatz trajectory, I was pleasantly surprised today to come upon a more generalised version of it. It goes by the name of the P\(x\) + 1 map of which the Collatz trajectory is a specific example in which P = 3. The P\(x\) + 1 trajectory or map is an algorithm that states: 

If \(x\) is divisible by any prime < P then divide out these primes one at a time starting with the smallest; otherwise multiply \(x\) by P and add 1.

My number for today is 25186 and it appears as an entry in OEIS A057534 that states:
  • a(\(n\) +1) = a(\(n\))/2 if 2 | a(\(n\))
  • a(\(n\)+1) = a(\(n\)) / 3 if 3 | a(\(n\))
  • a(\(n\)+1) = a(\(n\)) / 5 if 5 | a(\(n\))
  • a(\(n\)+1) = a(\(n\)) / 7 if 7 | a(\(n\))
  • a(\(n\)+1) = a(\(n\)) / 11 if 11 | a(\(n\))
  • a(\(n\)+1) = a(\(n\)) / 13 if 13 | a(\(n\))
  • else a(\(n\)+1) = 17 x a(\(n\)) + 1
This is a particular example of the P\(x\) + 1 map in which P = 17 and this generates a sequence, part of which is shown below:

61, 1038, 519, 173, 2942, 1471, 25008, 12504, 6252, 3126, 1563, 521, 8858, 4429, 75294, 37647, 12549, 4183, 71112, 35556, 17778, 8889, 2963, 50372, 25186, 12593, 1799, 257, 4370, 2185, 437, 7430, 3715, 743, 12632, 6316, 3158, 1579, 26844, 13422, ...

Well, that was then, and so let's write out the above sequence in full because it is finite and loops. Here are the 84 terms (or 83 steps) with 61 added at the end to show the return to source:

61, 1038, 519, 173, 2942, 1471, 25008, 12504, 6252, 3126, 1563, 521, 8858, 4429, 75294, 37647, 12549, 4183, 71112, 35556, 17778, 8889, 2963, 50372, 25186, 12593, 1799, 257, 4370, 2185, 437, 7430, 3715, 743, 12632, 6316, 3158, 1579, 26844, 13422, 6711, 2237, 38030, 19015, 3803, 64652, 32326, 16163, 2309, 39254, 19627, 333660, 166830, 83415, 27805, 5561, 94538, 47269, 803574, 401787, 133929, 44643, 14881, 252978, 126489, 42163, 3833, 65162, 32581, 553878, 276939, 92313, 30771, 10257, 3419, 263, 4472, 2236, 1118, 559, 43, 732, 366, 183, 61

Why am I discussing this sequence again today? Well, the number associated with my diurnal age today (\( \textbf{27805} \)) is a member of this sequence. We can see this more clearly if we arrange the terms in ascending order.

43, 61, 173, 183, 257, 263, 366, 437, 519, 521, 559, 732, 743, 1038, 1118, 1471, 1563, 1579, 1799, 2185, 2236, 2237, 2309, 2942, 2963, 3126, 3158, 3419, 3715, 3803, 3833, 4183, 4370, 4429, 4472, 5561, 6252, 6316, 6711, 7430, 8858, 8889, 10257, 12504, 12549, 12593, 12632, 13422, 14881, 16163, 17778, 19015, 19627, 25008, 25186, 26844, \( \textbf{27805} \), 30771, 32326, 32581, 35556, 37647, 38030, 39254, 42163, 44643, 47269, 50372, 64652, 65162, 71112, 75294, 83415, 92313, 94538, 126489, 133929, 166830, 252978, 276939, 333660, 401787, 553878, 803574

We can see that after 25186, the number that prompted my original post, there has only been one other member (26844) until today. If we start with 27805 then the sequence returns to this same number after 85 iterations (permalink):

27805, 5561, 94538, 47269, 803574, 401787, 133929, 44643, 14881, 252978, 126489, 42163, 3833, 65162, 32581, 553878, 276939, 92313, 30771, 10257, 3419, 263, 4472, 2236, 1118, 559, 43, 732, 366, 183, 61, 1038, 519, 173, 2942, 1471, 25008, 12504, 6252, 3126, 1563, 521, 8858, 4429, 75294, 37647, 12549, 4183, 71112, 35556, 17778, 8889, 2963, 50372, 25186, 12593, 1799, 257, 4370, 2185, 437, 7430, 3715, 743, 12632, 6316, 3158, 1579, 26844, 13422, 6711, 2237, 38030, 19015, 3803, 64652, 32326, 16163, 2309, 39254, 19627, 333660, 166830, 83415, 27805

Figure 1 shows a plot of these values using a logarithmic scale:


Figure 1: permalink

Now this sequence of length 84 or 83 steps is not the longest by far, In fact as the numbers get larger then the lengths of the record breaking sequence lengths also increases steadily. Table 1 shows these record step lengths for numbers up to 40000 as well as indicating whether the sequences end up looping or reaching 1.

\( \textbf{17x + 1} \)


Table 1: record step lengths of 17\(x\) + 1
permalink

It must be said the generation of this table timed out using SageMathCell and needed to be completed in my Jupyter notebook. While we are on the topic, we should look at the record step lengths for primes 3, 5, 7, 11 and 13 as well. Let's start with 13\(x\) + 1. The numbers with record breaking steps are as follows (with Table 2 showing more detail):

1, 2, 4, 8, 13, 26, 41, 61, 122, 197, 271, 529, 661, 1322, 1607, 3214, 4337, 4597, 4981, 7663, 15326, 27859
\( \textbf{13x + 1} \)


Table 2: record step lengths of 13\(x\) + 1
permalink

The numbers with record breaking steps for P11 + 1 are as follows (with Table 3 showing more detail):

1, 2, 4, 8, 11, 22, 23, 46, 92, 151, 247, 407, 653, 883, 977, 1313, 1703, 2477, 4954, 6847, 12449, 14471, 19013, 21527, 22627, 39281

\( \textbf{11x + 1} \)

Table 3: record steps lengths of 11\(x\) + 1
permalink

The numbers with record steps for P7 + 1 are (with Table 4 showing more details):

1, 3, 6, 7, 11, 19, 31, 49, 53, 106, 121, 163, 283, 343, 403, 806, 1471, 1681, 1919, 3133, 4243, 4849, 8659, 11683, 12373, 24746, 30301, 35803

\( \textbf{7x + 1} \)


Table 4: record step lengths of 7\(x\) + 1
permalink

The numbers with record steps for P5+1 are (with Table 5 showing more details):

1, 2, 4, 5, 10, 20, 23, 46, 47, 85, 95, 190, 380, 383, 766, 919, 1655, 2117, 3575, 6097, 6503, 10463, 12053, 24106, 28927, 39053

\( \textbf{5x + 1} \)

Table 5: record steps lengths of 5\(x\) + 1
permalink

The numbers with record lengths for P3 + 1 (with Table 6 showing more details) are:

1, 3, 6, 7, 9, 18, 25, 27, 54, 73, 97, 129, 171, 231, 313, 327, 649, 703, 871, 1161, 2223, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 23529, 26623, 34239, 35655

\( \textbf{3x + 1} \)

Table 6: record lengths for 3\(x\) + 1
permalink

If we collect all the numbers from all the sequences above then we have a list of all the numbers that reach a record number of steps under the P\(x\) + 1 mappings where \(x\) = 3, 5, 7, 11, 13 and 17. Here is the list in the range from 1 to 40,000:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 18, 19, 20, 22, 23, 25, 26, 27, 31, 41, 43, 46, 47, 49, 53, 54, 61, 73, 85, 92, 95, 97, 106, 121, 122, 129, 151, 163, 171, 173, 183, 190, 197, 231, 247, 257, 263, 271, 283, 313, 327, 343, 366, 380, 383, 403, 407, 437, 519, 521, 529, 559, 649, 653, 661, 703, 732, 743, 766, 806, 871, 883, 919, 977, 1038, 1118, 1161, 1313, 1322, 1471, 1563, 1579, 1607, 1655, 1681, 1703, 1799, 1919, 2117, 2185, 2223, 2236, 2237, 2309, 2463, 2477, 2919, 2942, 2963, 3126, 3133, 3158, 3214, 3419, 3575, 3711, 3715, 3803, 3833, 4183, 4243, 4337, 4370, 4429, 4472, 4597, 4849, 4954, 4981, 5561, 6097, 6171, 6252, 6316, 6503, 6711, 6847, 7430, 7663, 8659, 8858, 8889, 10257, 10463, 10971, 11683, 12053, 12373, 12449, 12504, 12549, 12593, 12632, 13255, 13422, 14471, 14881, 15326, 16163, 17647, 17778, 19013, 19015, 19627, 21527, 22627, 23529, 24106, 24746, 25008, 25186, 26623, 26844, 27805, 27859, 28927, 30301, 30771, 32326, 32581, 34239, 35556, 35655, 35803, 37647, 38030, 39053, 39254, 39281

Thursday, 15 May 2025

Revisiting Fibodiv and Repfigit Numbers

On the 21st January 2024, I made a post titled Fibodiv Numbers and today I'm revisiting this topic because \( \textbf{27801} \), the number associated with my diurnal age today, is one such number. There aren't many of them. In the range up to one million, there are only 233. Up to 40,000 these are (permalink):

14, 19, 28, 47, 61, 75, 122, 149, 183, 199, 244, 298, 305, 323, 366, 427, 488, 497, 549, 646, 795, 911, 969, 1292, 1301, 1499, 1822, 1999, 2087, 2602, 2733, 2998, 3089, 3248, 3379, 3644, 3903, 4555, 4997, 5204, 5466, 6178, 6377, 6496, 6505, 7288, 7806, 7995, 8199, 8845, 9107, 9161, 9267, 9744, 10408, 11709, 12356, 12992, 13010, 14311, 14999, 15445, 15612, 16913, 17690, 18214, 18322, 18534, 19515, 19999, 20816, 20987, 21623, 22117, 23418, 24712, 24719, 26020, 27321, 27483, 27801, 28622, 29107, 29923, 29998, 30890, 31224, 32498, 32525, 33826, 33979, 35127, 36428, 36644, 37729, 39030

These numbers form OEIS A130792: numbers \(k\) whose representation can be split in two parts which can be used as seeds for a Fibonacci-like sequence containing \(k\) itself. 

In that OEIS entry Mathematica code has been entered which is incomprehensible to me but fortunately Google Gemini (or similar) can be used to convert this code to Python that can then be run in SageMathCell. The Python code runs perfectly and quickly generates the 233 Fibodiv numbers. Gemini also provides an explanation of how the code works and additional help can be obtained if needed (link). This ease of converting from any programming language to a language of ones own choice is very useful.

So let's see how 27801 earns it right of inclusion into OEIS A130792 (permalink):$$27, 801, 828, 1629, 2457, 4086, 6543, 10629, 17172, 27801$$We see how the two parts of 27801, 27 and 801, serve as seeds for a Fibonacci-like sequence that eventually generates the number 27801.

Now Repfigit numbers are similar to Fibodiv numbers and in fact the two digit Repfigit numbers are also Fibodiv numbers. I discussed these in my post On Turning 75 on April 3rd 2024. They belong to OEIS A007629: Repfigit (REPetitive FIbonacci-like diGIT) numbers (or Keith numbers): numbers \(n\) with \(k\) digits such that a Fibonacci-like sequence can be defined using as seeds the digits of \(n\) and then at each step adding the last \(k\) terms. If \(n\) itself appears in the sequence, then it is a repfigit number. Up to 40000, the members of this sequence are (permalink):

14, 19, 28, 47, 61, 75, 197, 742, 1104, 1537, 2208, 2580, 3684, 4788, 7385, 7647, 7909, 31331, 34285, 34348

An example is 197 with three digits such that:$$1, 9, 7, 17, 33, 57, 107, 197$$We can see that:$$ \begin{align} 1 + 9 + 7 &= 17\\ 9+7+17 &= 33 \\ 7 + 17 + 33 &=57 \\ 17 + 33 + 57 &=107 \\33+57+107 &= 197 \end{align} $$A full list of Keith numbers can be found at this site. 

Wednesday, 14 May 2025

Some Interesting Integer Ratios

The number \( \textbf{27800} \) (my diurnal age today) has the following divisors: 1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 139, 200, 278, 556, 695, 1112, 1390, 2780, 3475, 5560, 6950, 13900, 27800. If we concatenate these divisors in the order shown (from smallest to largest) we get the rather large integer shown below.

1245810202540501001392002785566951112139027803475556069501390027800

The sum of these divisors is 65100 and it so happens that 65100 divides this concatenated number without remainder to give:

19136869470668218147342592712241952567419781927427896612924578

Numbers with this property belong to OEIS A308486: numbers such that the sum of divisors divides the concatenation (in ascending order) of divisors. The initial members up to 40000 are (permalink):

1, 2, 6, 10, 40, 98, 112, 120, 1904, 2680, 4040, 4128, 5136, 9920, 12224, 17900, 20880, 27800

Looking at the number 98 in the list we see that its divisors are 1, 2, 7, 14, 49 and 98 that have a total sum of 171 and whose concatenated divisors form the number 127144998. Thus we have:$$ \begin{align} \frac{127144998}{171} &= \frac{2 \times 3^3 \times 19 \times 123923}{3^2 \times 19} \\ &= 2 \times 3 \times 123932 \\ &=743538 \end{align} $$What if we consider the concatenation of a number's factors (with repetition) and whether it can be divided by its sum of factors (again with repetition). We need to ignore the prime numbers or else they will all get included. There are 277 composite numbers satisfying the criterion in the range up to 40000 (permalink):

8, 14, 20, 24, 27, 62, 125, 150, 160, 180, 194, 218, 300, 343, 452, 510, 512, 548, 570, 605, 612, 627, 651, 662, 663, 720, 935, 1183, 1210, 1235, 1331, 1335, 1575, 1676, 1994, 2090, 2106, 2130, 2197, 2218, 2303, 2337, 2345, 2350, 2428, 2436, 2640, 2667, 2675, 2679, 2744, 3087, 3102, 3108, 3168, 3237, 3275, 3399, 3509, 3553, 3740, 3835, 4029, 4046, 4125, 4180, 4347, 4384, 4392, 4410, 4488, 4565, 4704, 4805, 4913, 5015, 5037, 5047, 5120, 5551, 5829, 5888, 5968, 6223, 6250, 6549, 6662, 6666, 6747, 6837, 6859, 6888, 6923, 7030, 7189, 7337, 7448, 7449, 7462, 7488, 8000, 8064, 8165, 8246, 8421, 8624, 8742, 8853, 8949, 9000, 9331, 9344, 9709, 9804, 9975, 9990, 10017, 10125, 10146, 10240, 10387, 10800, 10854, 10865, 10879, 10989, 11045, 11121, 11205, 11264, 11704, 11891, 12032, 12152, 12167, 12288, 12337, 13237, 13243, 13277, 13284, 13702, 13792, 13824, 13858, 14308, 14457, 14555, 14580, 15015, 15025, 15042, 15054, 15301, 15552, 15820, 16038, 16428, 16549, 16827, 16856, 17347, 17496, 17600, 17850, 17914, 17949, 18172, 18213, 18377, 18495, 18821, 18963, 19135, 19425, 19513, 19683, 19860, 19885, 19910, 20041, 20083, 20727, 20746, 20878, 20951, 21033, 21175, 21197, 21340, 21965, 21978, 22008, 22021, 22152, 22275, 22317, 23069, 23280, 23548, 23715, 23785, 23998, 24037, 24244, 24389, 24986, 25182, 25344, 25647, 26129, 26754, 27010, 27480, 27664, 27832, 27880, 28006, 28037, 28566, 28577, 28840, 28896, 29064, 29281, 29326, 29388, 29602, 29614, 29624, 29783, 29791, 30082, 30186, 30226, 30229, 30240, 30420, 30814, 30825, 31097, 31349, 31412, 31581, 31780, 32076, 32418, 32640, 32697, 33292, 33473, 33480, 34132, 34133, 34481, 34521, 34773, 35046, 35557, 35616, 36022, 36040, 36162, 36176, 36478, 36504, 37026, 37789, 38024, 38200, 38340, 38399, 38480, 38658, 39292, 39406, 39463

This sequence of numbers is NOT to be found in the OEIS. Let's look at one of the numbers in the above list, namely 27832.$$27832=2^3 \times 7^2 \times 71$$The concatenated factors form the number 2227771 and the sum of these divisors is 91. Thus we have:$$ \begin{align} \frac{2227771}{91} &= \frac{7 \times 13 \times 24481}{7 \times 13} \\ &=24481 \end{align} $$There are other variations on the two themes covered in this post. For example, we could consider only the proper divisors of a number and look for numbers whose proper divisors, when concatenated from smallest to largest, are divisible by the sum of the proper divisors. We need to exclude prime numbers because the proper divisor in every case is 1 and thus will divide any number. There are 38 composite numbers in the range up to 40000 (permalink):

4, 15, 18, 24, 69, 208, 247, 501, 559, 565, 692, 697, 1501, 2077, 2257, 2759, 3551, 3661, 4135, 4227, 5123, 5461, 5536, 6109, 8640, 10821, 12179, 12667, 13631, 16939, 19781, 23587, 24307, 26827, 27331, 30701, 33877, 38887

Let's consider 69 in the previous list. It has proper divisors of 1, 3 and 23 that form the concatenated number 1323 with a sum of 27. Thus we have:$$ \begin{align} \frac{1323}{27} &= \frac{3^3 \times 7^2}{3^3} \\ &=7^2 \\ &=49 \end{align}$$Again this sequence is NOT to be found in the OEIS. Interestingly, the concatenated proper divisors of 8640 (one of the sequence members) form the following enormous cancatenated number:

12345689101215161820242730323640454854606472809096108120135144160180192216240270288320360432480540576720864960108014401728216028804320