Showing posts with label repeated digits. Show all posts
Showing posts with label repeated digits. Show all posts

Saturday, 10 May 2025

An Interesting Looping Digit Sequence

A paucity of information about a number always challenges me to find something interesting about the number. Such was the case with the number associated with my diurnal age today: \( \textbf{27796} \). I could see that the first two digits of the number, 2 and 7, added to give the fourth digit and the fourth digit plus the fifth digit gave the rightmost digit (6) of the resultant sum (16). This was almost a Fibonacci sequence mod 10 except that the repeated digit 7 got in the way. 

So I devised the following set of rules. 

  1. Let \(a\) and \(b\) be the first two digits of the sequence \( (a,b)\)
  2. If \(b \neq 7 \), \(c=a+b \pmod {10}\) gives the next digit
  3. Let \(a,b=b,c\)
  4. If \(b=7\) then \(c=7\) and \(d=a +b \pmod {10} \) give the next two digits
  5. Let \(a,b=c,d\)
Applying these rules when \(a=2\) and \(b=7\) gives the following 68 member sequence (permalink):

[2, 7, 7, 9, 6, 5, 1, 6, 7, 7, 3, 0, 3, 3, 6, 9, 5, 4, 9, 3, 2, 5, 7, 7, 2, 9, 1, 0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 7, 0, 7, 7, 7, 7, 4, 1, 5, 6, 1, 7, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 7, 5]

How might we define 27796 in terms of this sequence? Well, perhaps like this. 27796 is the concatenation of the first five digits of the previous sequence created according to the rules 1 to 5 defined above. The digits of the sequence repeat when the 69th term is reached. The final two digits, 7 and 5, mark the end of the sequence because:$$ \begin{align} 7 + 5 &= 2 \pmod {10} \\ 5 + 2 &= 7 \end{align} $$Thus we have the same two digits, 2 and 7, that we started with. Figure 1 shows the progression of digits.


Figure 1: permalink

It can be considered that we are building a 68 digit number from a starting two digit number of 27. We might represent the number thus (with the superscript 7 representing the digit that is repeated and the overline indicating the cycle of 68 digits):$$ ^7 \, \overline{27796 \dots 98775}$$The number builds as follows:$$27, 277, 2779, 27796, \dots$$If we start with \(a=0\) and \(b=1\), as in the classic Fibonacci sequence, we still end up with a cycle of 68 and 7 is still the digit that's repeated. Here is the sequence (permalink) with Figure 2 showing the progression in graphical format:

[0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 7, 0, 7, 7, 7, 7, 4, 1, 5, 6, 1, 7, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 7, 5, 2, 7, 7, 9, 6, 5, 1, 6, 7, 7, 3, 0, 3, 3, 6, 9, 5, 4, 9, 3, 2, 5, 7, 7, 2, 9, 1, 0]

Figure 2: permalink

It's easy to modify the algorithm so that a digit other than 7 gets repeated. Let's repeat the digit 6. In this case we end up with following 64 member looping sequence (permalink) with Figure 3 showing the progression in graphical format:

[2, 7, 9, 6, 6, 5, 1, 6, 6, 7, 3, 0, 3, 3, 6, 6, 9, 5, 4, 9, 3, 2, 5, 7, 2, 9, 1, 0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5]

Figure 3: permalink

This time we can consider that we are building a 64 digit number:$$ ^6 \, \overline{27966 \dots 99875}$$The number builds as follows:$$27, 279, 2796, 27966, \dots$$Thus 27966 could similarly be described as the concatenation of the first five digits of the previous sequence created according to the rules 1 to 5 defined above. The digits of the sequence repeat when the 65th term is reached. There are many other combinations of digits that could be explored but the point of this post is that interesting number patterns can always be found with just a little scrutiny and imagination.

I've made two previous posts about numbers whose digits display Fibonacci-like properties. These posts are Additive Fibonacci-like Numbers in August 2024 and Consolidating Fibonacci-like Numbers in November of 2024. In the former post I looked at numbers like 28191 where the arithmetic digital root was invoked to reveal a Fibonacci-like progression:$$ \begin{align} 2+8 &=10 \rightarrow 1 \\8+1 &= 9 \\1+9 &=10 \rightarrow 1  \end{align}$$Here the digital root of the two previous digits determines the next digit which is then concatenated with the previous digits. This process again produces a looping sequence of digits and a 24 digit number that repeats endlessly (permalink):$$ \begin {align} &2, 8, 1, 9, 1, 1, 2, 3, 5, 8, 4, 3, 7, 1, 8, 9, 8, 8, 7, 6, 4, 1, 5, 6\\\ &\overline{281911235843718988764156} \end{align}$$Alternatively, the digital root of all the previous digits can be used to determine the next digit. For example, 26875 where:$$ \begin{align} 2 + 6 &= 8\\ 2+6 + 8 &=16 \rightarrow 7\\ 2 + 6 + 8 + 7 &=23 \rightarrow 5 \end{align}$$In Consolidating Fibonacci-like Numbers, I considered numbers in base 10 that display Fibonacci-like properties when converted to other bases. I did not use digital roots for these cases, only digit sums. For example, 27802 in base 14:$$ \begin{align} 27802 &=\text{a1bc}_{14}\\ \text{a+1}&=\text{b} \\ \text{1+b} &=\text{c} \end{align}$$Related: The Pisano Period.

Thursday, 27 October 2022

Digitally Distinct (2D) and Doubly Digitally Distinct (3D) Numbers

Digitally Distinct Number or 2D number is a term that I concocted to describe a number that has:

  • no repeated digits  
  • an additive digital root that is different to any of its digits
The number associated with my diurnal age today, 26870, is one such number since it clearly has no repeated digits and its additive digital root is 5.

The numbers 0 to 9 do not qualify because they are identical to their additive digital roots. However, 12 has an additive digital root of 3 and thus it is the first 2D number and begins a run of seven consecutive such numbers viz. 12, 13, 14, 15, 16, 17 and 18. The percentage of such numbers declines with their size. Here is a summary:

  • 0 -10 0.00%
  • 0 - 100 56.0%
  • 0 - 1000 50.4%
  • 0 - 10000 31.0%
  • 0 - 100000 16.2%
  • 0 - 1000000 6.99%
Once a number has more than nine digits, it cannot be a 2D number because at least one digit would then repeat. The upper limit must be below 987,654,320, a number that has an additive digital root of 8 and is thus not a 2D number. I excluded 987,654,321 because additive digital roots lie between 1 and 9 and all those digits are taken. The question that must be asked is what is the largest 2D number? It can contain no more than nine digits and one of those must be zero. Testing revealed that:
  • no nine digit number containing the digit 9 can be a 2D number
  • 876,543,210 qualifies as a 2D number since it has a digital root of 9
So it is that 876,543,210 is the largest 2D number although all of the 8 x 8! = 322,560 (leading zeros not allowed) possible permutations are of course 2D numbers.

In the range between 26500 and 27000, the percentage of 2D numbers is 17.2%. The numbers are (with my diurnal age shown in bold):

26503, 26504, 26508, 26509, 26513, 26514, 26517, 26518, 26530, 26531, 26539, 26540, 26541, 26548, 26549, 26571, 26578, 26580, 26581, 26584, 26587, 26589, 26590, 26593, 26594, 26598, 26703, 26704, 26708, 26715, 26730, 26740, 26748, 26749, 26751, 26758, 26780, 26784, 26785, 26789, 26794, 26798, 26803, 26805, 26807, 26809, 26814, 26815, 26830, 26834, 26839, 26841, 26843, 26845, 26847, 26850, 26851, 26854, 26857, 26859, 26870, 26874, 26875, 26879, 26890, 26893, 26895, 26897, 26904, 26905, 26908, 26935, 26938, 26940, 26945, 26947, 26950, 26953, 26954, 26958, 26974, 26978, 26980, 26983, 26985, 26987

Here is a permalink to the algorithm that I used to generate these numbers. 

An interesting extension is to consider the multiplicative digital root which is the single digit reached when multiplying the digits of the number together (the results can range from 0 to 9). I've concocted the term Doubly Digitally Distinct or 3D for numbers that satisfy the following criteria:
  • no repeated digits
  • an arithmetic digital root that is different to any of its digits
  • a multiplicative digital root that is different to any of its digits and also to the arithmetic digital root
Applying these criteria to the same range of numbers as earlier (26500 to 27000), we find 11.6% of numbers satisfy. These are:

26513, 26514, 26517, 26518, 26531, 26539, 26541, 26548, 26549, 26571, 26578, 26581, 26584, 26587, 26589, 26593, 26594, 26598, 26715, 26748, 26749, 26751, 26758, 26784, 26785, 26789, 26794, 26798, 26814, 26815, 26834, 26839, 26841, 26843, 26845, 26847, 26851, 26854, 26857, 26859, 26874, 26875, 26879, 26893, 26895, 26897, 26935, 26938, 26945, 26947, 26953, 26954, 26958, 26974, 26978, 26983, 26985, 26987

The number 26870 does not qualify as a 3D number because its multiplicative digital root is 0 and that is one of the digits of the number. In fact, any number containing a zero cannot be a 3D number. However, the nearby 26874 and 26875 both qualify as they have additive digital roots of 9 and 1 respectively and multiplicative digital roots of 0. A similar table to that shown above but this time for 3D numbers looks like this.
  • 0 -10  0.00%
  • 0 - 100 33.0%
  • 0 - 1000  26.7%
  • 0 - 10000 14.9%
  • 0 - 100000 7.61%
  • 0 - 1000000 2.78%
Here is a permalink that can be used to generate the statistics in this table. The first 3D number is 23 and it begins a run of three consecutive such numbers: 23, 24 and 25. We see that:
  • 23 has an additive digital root of 5 and a multiplicative digital root of 6
  • 24 has an additive digital root of 6 and a multiplicative digital root of 8
  • 25 has an additive digital root of 7 and a multiplicative digital root of 0
However, the next number 26 has an additive digital root of 8 and a multiplicative digital root of 2 which is one of the digits of the original number. Thus it does not meet the criteria. The question remains as to what is the largest 3D number. It cannot contain more than eight distinct digits. Testing revealed that:
  • no eight digit number containing the digit 9 is a 3D number
  • 87,654,321 qualifies as a 3D number
    • It has a arithmetic digital root of 9
    • it has a multiplicative digital root of 0
So 87,654,321 is the largest 3D number although any of the 8! = 40,320 permutations of those digits will also be a 3D number.

ADDENDUM 
October 30th 2020

It occurred to me that it would also be interesting to look at the "complement" of 2D and 3D numbers. The complement of 2D numbers I will define as numbers that have at least one repeated digit and whose arithmetic digital root is one of the digits of the number. The complement of 3D numbers I will define as numbers that have at least one repeated digit and whose arithmetical digital root and multiplicative digital roots are digits of the number.

Here is a permalink to an algorithm that will identify complementary 3D numbers in the range up to 40,000. I have also made an entry in my Bespoken For Sequences. Such numbers comprise 8.01% of the range. Here are the initial members: 0, 100, 118, 181, 188, 200, 299, 300, 400, 500, 600, 700, 800, 811, 818, 881, 899, 900, 909, 929, 989, 990, 992, 998, 1000.

Numbers like 1000 clearly qualify for membership so let's take the less obvious 998. The number has one repeated digit (9) and its arithmetic digital root is 8 while its multiplicative digital root is also 8. Thus it qualifies too. Clearly such complementary 2D and 3D numbers have no upper bound unlike the 2D and 3D numbers themselves. 

Monday, 26 July 2021

St. Ives

 

As I was going to St. Ives,

I met a man with seven wives,

Each wife had seven sacks,

Each sack had seven cats,

Each cat had seven kits:

Kits, cats, sacks, and wives,

How many were there going to St. Ives? 

The traditional understanding of this rhyme is that only one is going to St. Ives—the narrator. All of the others are coming from St. Ives. The trick is that the listener assumes that all of the others must be totalled up, forgetting that only the narrator is said to be going to St. Ives. If everyone mentioned in the riddle were bound for St. Ives, then the number would be 2,802: the narrator, the man and his seven wives, 49 sacks, 343 cats, and 2,401 kits. Wikipedia.

The progression 7, 49, 343 and 2401 corresponds to successive powers of seven: \(7^1, 7^2, 7^3\) and \(7^4\). The St. Ives rhyme came to mind because today I turned 26411 days old and this number has the interesting property that it can be written:$$26411=7 \times 7 \times 7 \times 77$$This property qualifies it for membership in OEIS A161145:


 A161145

Numbers which can be expressed as the product of numbers made of only sevens.


The members of the sequence, up to 100,000 are:
1, 7, 49, 77, 343, 539, 777, 2401, 3773, 5439, 5929, 7777, 16807, 26411, 38073, 41503, 54439, 59829, 77777

Of course, 7 wives, 49 sacks, 343 cats and 2401 kittens make an appearance in this sequence along with 26411. Clearly, I won't be celebrating number 38073 as this corresponds to Sunday, June 29th 2053 when I would be 104 years old. 

I devised a general purpose algorithm in SageMath that will generate not only the seven sequence but sequences for all digits between 2 and 9 inclusive. Here is its permalink. Applying this algorithm, I was able to generate the beginning members of OEIS A161140:


 A161140

Numbers which can be expressed as the product of numbers made of only twos.


Unfortunately the calculation timed out for the range up to 100,000 so I needed to restrict the range to 30,000. The members up to that point are:
1, 2, 4, 8, 16, 22, 32, 44, 64, 88, 128, 176, 222, 256, 352, 444, 484, 512, 704, 888, 968, 1024, 1408, 1776, 1936, 2048, 2222, 2816, 3552, 3872, 4096, 4444, 4884, 5632, 7104, 7744, 8192, 8888, 9768, 10648, 11264, 14208, 15488, 16384, 17776, 19536, 21296, 22222, 22528, 28416
Let's take 28416 as an example:$$28416=2 \times 2 \times 2 \times 2 \times 2 \times 2 \times 2 \times 222$$Applying the algorithm so that all numbers are made up to threes generates OEIS A161141:


 A161141

Numbers which can be expressed as the product of numbers made of only threes.

The members, up to 100,000, are:

1, 3, 9, 27, 33, 81, 99, 243, 297, 333, 729, 891, 999, 1089, 2187, 2673, 2997, 3267, 3333, 6561, 8019, 8991, 9801, 9999, 10989, 19683, 24057, 26973, 29403, 29997, 32967, 33333, 35937, 59049, 72171, 80919, 88209, 89991, 98901, 99999

Let's take 35937 as an example:$$35937=33 \times 33 \times 33$$Moving on to all fours (so to speak), we get OEIS A161142:


 A161142

Numbers which can be expressed as the product of numbers made of only fours.

 The members, up to 100,000, are:

1, 4, 16, 44, 64, 176, 256, 444, 704, 1024, 1776, 1936, 2816, 4096, 4444, 7104, 7744, 11264, 16384, 17776, 19536, 28416, 30976, 44444, 45056, 65536, 71104, 78144, 85184

Let's take 17776 as an example:$$17776=4 \times 4444$$Moving on again to all fives, we get OEIS A161143:


 A161143

Numbers which can be expressed as the product of numbers made of only fives.


The members, up to 100,000, are:
1, 5, 25, 55, 125, 275, 555, 625, 1375, 2775, 3025, 3125, 5555, 6875, 13875, 15125, 15625, 27775, 30525, 34375, 55555, 69375, 75625, 78125

Let's take 34375 as an example:$$34375=5 \times 5 \times 5 \times 5 \times 55$$Moving on further to all sixes, we get OEIS A161144:


 A161144



Numbers which can be expressed as the product of numbers made of only sixes.

 The members up to 100,000, are:

1, 6, 36, 66, 216, 396, 666, 1296, 2376, 3996, 4356, 6666, 7776, 14256, 23976, 26136, 39996, 43956, 46656, 66666, 85536

Let's take 43956 as an example:$$43956=66 \times 666$$Moving on to all eights, we get OEIS A161146:


 A161146

Numbers which can be expressed as the product of numbers made of only eights.

 The members, up to 100,000, are:

1, 8, 64, 88, 512, 704, 888, 4096, 5632, 7104, 7744, 8888, 32768, 45056, 56832, 61952, 71104, 78144, 88888

Let's use 71104 as an example:$$71104=8 \times 8888$$Moving on to all nines, we get OEIS A161147:


 A161147

Numbers which can be expressed as the product of numbers made of only nines.


The members, up to 100,000, are:
1, 9, 81, 99, 729, 891, 999, 6561, 8019, 8991, 9801, 9999, 59049, 72171, 80919, 88209, 89991, 98901, 99999

Let's use 59049 as an example:$$59049=9 \times  9  \times 9 \times 9  \times 9$$

Thursday, 29 March 2018

Repeating Digits in the Squares of Integers

Today I turned 25197 days old and none of the entries in the Online Encyclopaedia of Integer Sequences (OEIS) made much sense to me. I searched about for something of interest about this number and, after some dead-ends, I thought I'd square the number. The result was 634888809 which immediately caught my attention because of the repetition of the digit 8. I thought this result would be relatively rare and something that distinguishes 25197 from most other numbers. My question was how rare? I set about investigating using a Google spreadsheet and had soon found all the numbers between 1 and 26000 whose squares contain at least four consecutive 8's. It turns out that there is a total of only 14 such numbers.

Here are the numbers with their associated squares

Runs of four or more 8's (there are 14 of these):

16092588881
699248888064
942888887184
10094101888836
12202148888804
16090258888100
16667277788889
16849283888801
20221408888841
20359414488881
21187448888969
22917525188889
24267588887289
25197634888809

It can be seen that the squares of 12202 and 20221 contain a run of five 8's. Naturally, I was curious about runs of the other digits 1, 2, 3, 4, 5, 6, 7 and 9 and once again used the spreadsheet to investigate the matter. The results are detailed below:

Run of four or more 1's (there are 11 such numbers:

28488111104
333411115556
10541111112681
10542111133764
10543111154849
10544111175936
10545111197025
17062291111844
20276411116176
20521421111441
23877570111129

What's interesting above is the cluster of numbers 10541, 10542, 10543, 10544 and 10545 that all produce at least four leading 1's (10541 produces five leading 1's).

Runs of four or more 2's (there are 18 of these):

333511122225
349612222016
458521022225
471422221796
541529322225
610137222201
833269422224
855773222249
13335177822225
14585212722225
15415237622225
16665277722225
16668277822224
20548422220304
20838434222244
23335544522225
24585604422225
25415645922225

Runs of four or more 3's (there are eight of these):

577433339076
730353333809
11547133333209
18037325333369
18257333318049
18258333354564
18259333391081
23094533332836

There is another cluster here consisting of 18257, 18258 and 18259, all producing a run of four leading 3's when squared. There is also a run of five 3's produced by 11547 when it is squared.

Runs of four or more 4's (there are 12 of these):

569632444416
666744448889
11595134444025
15393236944449
15857251444449
21081444408561
21082444450724
21083444492889
24229587044441
24788614444944
25386644448996
25771664144441

Here again there is a cluster of 21081, 21082 and 21083, all producing a run of four 4's when squared. One number 15857 produces a run of five 4's when squared. The square of 24788 contains six 4's though only four of them are consecutive.

Runs of four or more 5's (there are 14 of these):

23575555449
394415555136
416617355556
833469455556
10274105555076
10419108555561
12472155550784
15986255552196
16666277755556
20629425555641
20834434055556
22925525555625
23570555544900
23571555592041

Here we see that the square of 22925 contains six 5's, although only four of them are consecutive.

Runs of four or more 6's (there are ten of these):

12911666681
16332666689
25826666724
516426666896
816566667225
12910166668100
16330266668900
17224296666176
25819666620761
25820666672400

Here there are a pair of numbers, 25819 and 25820, that both produce a run of four leading 6's when squared.

Runs of four or more 7's (there are seven of these):

881977774761
11076122677776
13924193877776
16964287777296
18915357777225
21858477772164
24037577777369

Runs of four or more 9's (there are only two of these):

707149999041
14142199996164

It's surprising that there are only two numbers between 1 and 26000 that produce four sequential 9's when squared and the one is double the other. I'll need to investigate the reason for this paucity.

I've proposed the sequence of numbers that produce four or more 8's when squared as a candidate for the OEIS. If it's approved, I'll propose the other runs of four or more digits are candidate sequences as well.