Showing posts with label distinct. Show all posts
Showing posts with label distinct. Show all posts

Saturday, 25 April 2026

Testing For Simple Permutations

Having explained what a simple permutation is in my previous post, I thought that testing the number associated with my diurnal age would be a good idea. Here is the output for today's number \( \textbf{28146} \) (permalink):

Simple Permutation Analyzer initialized...

--- Analyzing Number: 28146 ---

Intermediate Stage:

  Digits ranked descending: [8, 6, 4, 2, 1]

  Rank mapping (1=highest): {8: 1, 6: 2, 4: 3, 2: 4, 1: 5}

  Normalized permutation:   [4, 1, 5, 3, 2]

Result: False

Reason: Failed: Sub-block [3, 2] from digits [4, 6] forms an interval.

Alternative: Try 28416 instead. It is a simple permutation using your digits.

Having found that the digits 28146 do not form a simple permutation, the program finds a permutation that is simple, namely 28416. I tried entering a number with repeated digits and the number was regarded as invalid. I asked Gemini why:

The Definition of a Strict Permutation

The primary reason duplicate digits are rejected is rooted in the mathematical definition of a permutation. In combinatorics, a standard permutation is strictly defined as a rearrangement of a set of distinct, distinguishable items. Every item in the set must be unique.

When you introduce duplicate items (like the number 88234), you are no longer working with a standard set. You are working with what mathematicians call a multiset. While you can arrange the elements of a multiset, the rules, formulas, and structural properties change entirely.

The Problem of Ambiguity

Permutation theory relies on knowing exactly how many unique arrangements can be made. If all elements are distinct, a sequence of length n will always have n! (n factorial) possible arrangements.

However, duplicates introduce ambiguity. Imagine the number 122. Let's label the identical twos to tell them apart: 1, 2a, 2b. If we swap the two 2s, we get a structurally identical number:

    • Arrangement A: 1, 2a, 2b (Displays as 122)
    • Arrangement B: 1, 2b, 2a (Displays as 122)

Because swapping identical digits does not create a new, distinct sequence, the total number of unique arrangements drops. The mathematical framework built to analyze the structure of permutations assumes that every single shift in position creates a fundamentally new sequence. Duplicates break this assumption.

How Duplicates Break the "Simple" Math

Beyond the theoretical definition, duplicate digits physically break the mathematical logic used to define a simple permutation.

Recall the formula we used in the algorithm to test for intervals: max(block) - min(block) == length - 1. This formula only works because it assumes that an interval of distinct integers will have a predictable span. For example, a block of three distinct, consecutive numbers like {4, 5, 6} will always have a span of 2 (because 6 - 4 = 2, and the length 3 minus 1 is 2).

If we allow duplicates, this logic collapses. Consider a block of two identical numbers: {5, 5}.

    • The length of the block is 2.
    • The maximum value is 5.
    • The minimum value is 5.
    • max - min is 0.

The formula expects a span of 1 for a block of length 2. Because the span is 0, the math fails to recognize what is happening. Furthermore, the entire concept of a "continuous range of numbers" becomes nonsensical when numbers repeat. Does {5, 5} constitute an interval? What about {4, 5, 5, 6}?

Because the definition of simple permutations was explicitly designed to map the structural scattering of distinct integers, attempting to apply it to repeating digits forces the math to evaluate scenarios it was never designed to handle.

Fair enough. I've incorporated this algorithm into my daily number analysis. The no repeated digits restriction means that only xenodromes are acceptable input.

Friday, 13 February 2026

Fibonacci From Prime Factors


Gemini's Infographic Summary of the Content in this Post

I noticed that the number (\( \textbf{28075} \)) associated with my diurnal age today has an interesting property relating to its prime factors:$$28075=5^2 \times 1123$$The number has distinct prime factors of \( \textbf{5}\) and \( \textbf{1123}\). If these two factors are written in reversed order and then concatenated, the number \( \textbf{11235}\) is formed with digits that form a Fibonacci sequence:$$1+1 \rightarrow 2 \text{ and } 2 + 3 \rightarrow 5$$This got me thinking about what other numbers have this property and so I set Gemini to work to find all such numbers in the range from 1 to 40000. It turns out that the following numbers qualify (permalink):

22, 26, 30, 44, 52, 60, 66, 70, 88, 90, 101, 104, 115, 120, 132, 140, 141, 150, 158, 167, 176, 180, 198, 203, 205, 208, 210, 240, 242, 253, 257, 264, 270, 280, 300, 301, 316, 330, 338, 347, 350, 352, 360, 396, 416, 420, 423, 427, 450, 480, 484, 490, 528, 540, 560, 575, 594, 600, 611, 617, 630, 632, 660, 676, 700, 704, 720, 726, 750, 771, 790, 792, 810, 832, 835, 840, 900, 960, 968, 980, 990, 1025, 1050, 1056, 1080, 1120, 1123, 1188, 1200, 1222, 1260, 1264, 1265, 1269, 1320, 1350, 1352, 1400, 1408, 1421, 1440, 1452, 1459, 1470, 1500, 1580, 1584, 1620, 1650, 1664, 1680, 1750, 1782, 1800, 1890, 1920, 1936, 1960, 1980, 2100, 2107, 2112, 2160, 2178, 2240, 2250, 2313, 2376, 2400, 2430, 2444, 2450, 2520, 2528, 2640, 2645, 2662, 2700, 2704, 2783, 2800, 2816, 2875, 2880, 2904, 2940, 2970, 2989, 3000, 3150, 3160, 3168, 3240, 3257, 3300, 3328, 3360, 3430, 3500, 3564, 3600, 3630, 3750, 3780, 3807, 3840, 3872, 3920, 3950, 3960, 4050, 4175, 4200, 4224, 4320, 4356, 4377, 4394, 4410, 4480, 4500, 4752, 4800, 4860, 4888, 4900, 4950, 5040, 5056, 5125, 5167, 5250, 5279, 5280, 5324, 5346, 5400, 5408, 5600, 5615, 5632, 5670, 5760, 5808, 5819, 5880, 5887, 5940, 6000, 6300, 6319, 6320, 6325, 6336, 6480, 6534, 6600, 6627, 6656, 6720, 6750, 6860, 6939, 7000, 7128, 7200, 7260, 7290, 7350, 7500, 7560, 7680, 7744, 7840, 7900, 7920, 7943, 7986, 8100, 8250, 8400, 8405, 8448, 8640, 8712, 8750, 8788, 8820, 8910, 8960, 9000, 9450, 9504, 9600, 9720, 9776, 9800, 9900, 9947, 10080, 10112, 10201, 10290, 10500, 10560, 10648, 10692, 10800, 10816, 10890, 11200, 11250, 11264, 11340, 11421, 11520, 11616, 11760, 11880, 12000, 12150, 12250, 12482, 12600, 12640, 12672, 12943, 12960, 13068, 13131, 13200, 13225, 13230, 13312, 13440, 13500, 13720, 13915, 14000, 14256, 14375, 14400, 14520, 14580, 14700, 14749, 14850, 15000, 15120, 15360, 15488, 15680, 15750, 15800, 15840, 15886, 15972, 16038, 16200, 16500, 16800, 16896, 17010, 17150, 17280, 17424, 17500, 17576, 17640, 17820, 17920, 18000, 18150, 18750, 18900, 19008, 19200, 19440, 19552, 19600, 19602, 19750, 19800, 19881, 20160, 20224, 20250, 20580, 20817, 20875, 20923, 21000, 21120, 21296, 21347, 21384, 21600, 21632, 21780, 21870, 22050, 22400, 22500, 22528, 22680, 23040, 23232, 23520, 23760, 23958, 24000, 24010, 24300, 24500, 24750, 24964, 25200, 25280, 25344, 25625, 25920, 26047, 26136, 26250, 26400, 26460, 26624, 26730, 26880, 27000, 27440, 27889, 28000, 28075, 28350, 28512, 28717, 28800, 29040, 29095, 29160, 29282, 29400, 29700, 30000, 30240, 30613, 30720, 30870, 30976, 31360, 31500, 31600, 31625, 31680, 31772, 31944, 32076, 32400, 32670, 33000, 33600, 33750, 33792, 34020, 34263, 34300, 34560, 34848, 35000, 35152, 35280, 35640, 35840, 36000, 36300, 36450, 36750, 37500, 37800, 38016, 38400, 38880, 39104, 39200, 39204, 39393, 39500, 39600, 39690, 39930

Of course looking at these numbers it's not immediately apparent what the Fibonacci digit sequence is but the Gemini program creates a table to show this. I'll restrict the range to between 28000 and 29000. The result is shown in Figure 1:


Figure 1: permalink

The fact that we are only considering \( \textbf{distinct} \) prime factors helps the program run quickly and there are no problems using it with SageMathCell. However if we allow multiplicity of factors, the number of permutations increases dramatically and SageMathCell quickly times out even if we restrict the range to between 28000 and 29000. So I think working only with distinct prime factors is the way to go.

Thursday, 6 November 2025

Passcodes and Repeated Digits

The content in this post is taken from this video on the YouTube channel MindYourDecisions. Figure 1 shows if the digits of a four digit code are known, there are 24 possibilites of the code contains four distinct digits but 36 possibilities if the code contains only three digits (with one digit repeated).


Figure 1

If no digits are repeated, then there are:$$4! = 4 \times 3 \times 2 \times 1 =24 \text{ possibilities}$$However if one digit is repeated then we have:$$ \frac{4!}{2!} \times 3 = 36 \text{ possibilities}$$What happens with a six digit passcode when we know the digits but not the order. If six digits are used, then we have:$$6! = 6 \times 5 \times 4 \times 3 \times 2 \times 1  = 720 \text{ possibilities}$$However, if one digit is repeated then we have:$$ \frac{6!}{2!} \times 5 =1800 \text{ possibilities: see Figure 2}$$

Figure 2

The formulae in general for distinct digits versus one repeated digit are:$$ n! \leftarrow \text{ versus } \rightarrow \frac{(n-1) \times n!}{2}$$Once we have \(n \geq 4\) then \( (n-1)/2 \) is greater than 1 and so the single repeated digit passcode will always yield more possibilities than the distinct digits. What about repeating more than one digit? 

Figure 3 shows the situation for six digit passcodes where it can be seen that one repeated digit yields the most possibilities:


Figure 3

However, for a seven digit posscode, using five distinct digits (with two digits repeated) yields the most possibilities. See Figure 4.


Figure 4

The video referenced earlier concludes with a mention of the general case and a rather formidable formula that I won't go into here.

Sunday, 22 June 2025

Sum of Divisors Meets the Totient

The number associated with my diurnal age today, \(\textbf{27838}\), has an interesting property that is not so obvious until we look at its sum of divisors and it totient:$$ \begin{align}  \sigma(27838) &= 43200 \\ &= 2^6 \times 3^3 \times 5^2 \\ &\rightarrow 2,3,5 \text{ as distinct prime factors}\\ \phi(27838) &= 13440 \\&= 2^7 \times 3 \times 5 \times 7 \\ &\rightarrow 2,3,5,7 \text{ as distinct prime factors} \end{align}$$For both the sum of divisors and the totient, the prime factors are consecutive. This got me thinking as to how many numbers enjoy this property in the range up to 40000. I wasn't requiring that the smallest factor be 2 for both the sum of divisors and the totient but this is certainly the case at least in the range under consideration. 

In developing my algorithm (permalink), I naturally only considered composite numbers but I also required the sum of divisors and the totient to be composite as well. It turns out that there are 785 such numbers with the smallest being 14:$$ \begin{align}  \sigma(14) &= 24 \\ &= 2^3 \times 3 \\ &\rightarrow 2,3 \text{ as distinct prime factors}\\ \phi(14) &= 6 \\&= 2 \times 3  \\ &\rightarrow 2,3 \text{ as distinct prime factors} \end{align}$$Table 1 shows the numbers between 27838 and 30000.


Table 1: permalink

Here is the full list of the 146 numbers between 27838 and 40000 (permalink):

27838, 27956, 28126, 28215, 28258, 28329, 28340, 28424, 28458, 28614, 28728, 28768, 28782, 28809, 28826, 28985, 29029, 29222, 29260, 29295, 29337, 29393, 29512, 29640, 29667, 29678, 29835, 29848, 30039, 30184, 30240, 30264, 30305, 30381, 30504, 30566, 30760, 30780, 30814, 30888, 30914, 30943, 30956, 30996, 31008, 31027, 31160, 31174, 31283, 31331, 31392, 31416, 31465, 31496, 31529, 31806, 31816, 32103, 32130, 32131, 32298, 32376, 32395, 32589, 32604, 32718, 32802, 32984, 33015, 33176, 33292, 33345, 33383, 33440, 33480, 33495, 33497, 33528, 33572, 33592, 33836, 33885, 33915, 34008, 34162, 34276, 34293, 34317, 34440, 34452, 34573, 34580, 34605, 34782, 34884, 35061, 35074, 35112, 35340, 35343, 35424, 35464, 35530, 35752, 35805, 35910, 35948, 35960, 36366, 36423, 36666, 36828, 36859, 36860, 36890, 36920, 37060, 37128, 37417, 37638, 37719, 37730, 37758, 37772, 37961, 38038, 38152, 38285, 38340, 38368, 38408, 38610, 38745, 38760, 38874, 39032, 39121, 39219, 39270, 39370, 39458, 39501, 39520, 39556, 39576, 39729

If we consider the sum of the \( \textbf{proper} \) divisors of a number together with the totient, we find that only 104 numbers qualify in the range from 1 up to 40000. These are (permalink):

42, 78, 90, 93, 135, 198, 216, 219, 259, 270, 273, 360, 364, 403, 438, 679, 723, 738, 793, 988, 1080, 1299, 1333, 1446, 1683, 1722, 1793, 1818, 1924, 2009, 2044, 2263, 2295, 2623, 2743, 2754, 2970, 3135, 3157, 3162, 3258, 3420, 3589, 3796, 3960, 4284, 4320, 4440, 4453, 4564, 4905, 5187, 5824, 5983, 5995, 6893, 6918, 7320, 7373, 7380, 7392, 7783, 7980, 8928, 8987, 9504, 9720, 9943, 10864, 10920, 11023, 11538, 11653, 11904, 14233, 15613, 15813, 16764, 17593, 18019, 20202, 22625, 24199, 24339, 24613, 25275, 25324, 25792, 27133, 28243, 28564, 30240, 30303, 30623, 31408, 31992, 32283, 32284, 34300, 34393, 34933, 36421, 36720, 39283

Not all the prime factors of the sum of proper divisors begin with 2 as can be seen in Table 2 that shows the details for numbers between 28000 and 40000:


Table 2: permalink

Thursday, 20 February 2025

Not the Sum of Distinct Squares or Cubes

I guess I'd never really thought about the issue before. I've written about what numbers can and cannot be expressed as a sum of two squares and what numbers cannot be expressed as a sum of three squares but what numbers \( \textbf{cannot} \) be expressed a sum of two or more distinct squares? Well, the answer is not many and 128 is the largest of them. These number form OEIS A001422 :


A001422    Numbers which are \( \textbf{not} \) the sum of \( \textbf{distinct} \) squares.


The numbers are: 2, 3, 6, 7, 8, 11, 12, 15, 18, 19, 22, 23, 24, 27, 28, 31, 32, 33, 43, 44, 47, 48, 60, 67, 72, 76, 92, 96, 108, 112, 128


This led me on to OEIS A001476 that deals with the same issue but involving cubes. 


A001476    Numbers that are \( \textbf{not} \) the sum of \( \textbf{distinct} \) positive cubes.


2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 93,94, 95, 96, 97, 98

These are the initial terms below 100 and the OEIS comments go on to say the following:
There are 85 terms below 100, 793 terms below 1000, but only 2765 terms below 10000, and only 23 more up to the largest term a(2788)=12758.

Sunday, 6 August 2023

Hidden Beast Numbers

The number associated with my diurnal age today, 27153, gave me the idea for what I'm terming "hidden beast numbers". This number factorises to 3 x 3 x 7 x 431 and its sum of prime factors, with multiplicity, is 444. This prompted me to find all numbers whose sum of prime factors have identical digits. This sequence does not appear in the OEIS but I added it to my Bespoken for Sequences.

However, in this post I'm only interested in those numbers whose prime factors add to 666, the so-called "number of the beast". Obviously in numbers like 27666, the three sixes are scarcely hidden but in a number like: $$ 998515 = 5 \times 7 \times 47 \times 607$$the three sixes are not so obvious. It is only when we add the 5, 7, 47 and 607 together that find the 666.

The 248 numbers (excluding numbers whose sum is a single digit) with this property are as follows (permalink) up to one million:

3305, 3966, 4613, 6590, 7908, 8489, 12293, 14366, 14789, 21998, 29093, 29486, 32489, 35813, 36568, 40133, 41139, 43289, 46373, 48868, 48975, 51353, 52240, 55193, 57989, 57998, 58770, 60713, 62688, 67288, 70524, 75699, 78244, 79913, 81989, 83333, 84206, 87173, 87448, 92933, 97432, 98379, 98789, 99653, 100889, 105113, 106468, 106755, 106793, 107753, 108389, 109289, 109611, 110213, 110489, 110633, 113726, 113872, 119198, 128106, 146392, 146644, 158515, 163455, 164691, 169886, 174352, 175539, 183998, 190218, 196146, 200846, 203032, 208975, 210926, 212248, 215246, 219566, 219998, 226450, 228411, 230488, 232683, 238779, 247555, 250770, 257368, 259299, 267488, 271740, 283672, 289539, 289856, 290788, 291655, 292312, 297066, 300924, 317848, 319131, 323500, 325348, 326088, 328851, 342808, 345499, 349986, 353650, 357579, 366849, 368548, 379455, 383128, 385659, 388200, 391588, 396628, 404752, 405844, 406552, 414080, 416650, 424380, 429028, 431019, 436725, 436888, 436948, 438244, 441098, 452672, 455346, 457371, 458968, 465840, 467571, 480963, 491499, 493570, 494488, 496896, 499980, 507955, 509256, 516339, 524070, 530115, 533312, 553539, 556299, 559008, 565456, 572575, 572913, 573208, 579352, 592284, 599976, 609546, 614872, 625155, 628884, 630140, 631768, 636138, 644859, 651771, 658975, 659395, 666832, 674008, 674973, 687090, 691731, 693592, 697255, 705100, 710739, 721048, 725650, 729688, 732896, 733912, 748371, 750186, 756168, 757912, 758259, 759615, 780291, 786328, 789592, 790770, 791274, 799015, 804952, 807832, 810256, 811179, 820899, 821272, 824508, 825651, 825979, 835288, 836706, 843352, 843488, 843855, 846120, 848728, 850689, 851992, 852651, 860248, 866968, 868312, 868888, 870780, 879452, 879655, 884559, 884619, 888291, 900112, 900200, 902528, 905571, 908811, 911538, 912543, 923931, 928832, 939699, 948771, 948924, 951885, 954819, 957243, 958491, 958818, 967779, 975339, 976851, 977499, 979179, 992563, 998515

Looking through this list we see that there is only one number that contains, overtly, the sequence 666. The number is: $$ 666832 = 2 \times 2 \times 2 \times  2 \times 71 \times 587 $$So this number is rather special in that it contains both on overt and covert 666 sequence. Of course, if we consider only distinct prime factors, ignoring multiplicity, we get a different list with only 192 members and with some numbers in common between the two lists. Permalink.

3305, 3966, 4613, 6590, 7932, 8489, 11898, 12293, 13180, 14366, 14789, 15864, 16525, 21998, 23796, 26360, 28732, 29093, 29486, 31728, 32291, 32489, 32950, 35694, 35813, 40133, 43289, 43996, 46373, 47592, 51353, 52720, 55193, 57464, 57989, 57998, 58972, 60713, 63456, 65900, 71388, 79913, 81989, 82625, 83333, 84206, 87173, 87992, 92933, 95184, 98789, 99653, 100889, 105113, 105440, 106755, 106793, 107082, 107753, 108389, 109289, 110213, 110357, 110489, 110633, 113726, 114928, 115996, 117944, 119198, 126912, 131800, 142776, 158026, 163455, 164750, 168412, 169886, 175539, 175984, 183998, 190368, 200846, 210880, 210926, 214164, 215246, 219566, 219998, 226037, 227452, 229856, 231992, 233567, 235888, 238396, 247555, 250770, 253824, 263600, 285552, 291655, 297066, 316052, 320265, 321246, 329500, 336824, 339772, 340147, 349986, 351968, 367996, 373966, 379455, 380736, 401692, 413125, 421760, 421852, 428328, 430492, 439132, 439996, 454904, 459712, 463984, 467571, 471776, 476792, 480963, 490365, 493570, 501540, 507648, 507955, 526617, 527200, 530115, 533775, 553539, 571104, 594132, 609546, 625155, 632104, 642492, 659000, 659395, 673648, 678178, 679544, 687090, 697255, 699972, 703936, 735992, 747932, 748371, 752310, 759615, 761472, 790770, 791274, 799015, 803384, 817275, 823750, 825979, 836706, 843520, 843704, 843855, 856656, 860984, 878264, 879655, 879992, 884559, 891198, 909808, 912543, 919424, 927968, 943552, 953584, 957243, 958818, 960795, 963738, 987140, 998515

Looking through the list, the first new number to appear is 11898 with the property that: $$ 11898 = 2 \times 3 \times 3 \times 661$$In this number, we ignore the second 3 and thus the sum is 2 + 3 + 661 = 666.