Saturday, 29 October 2022

Double Iterations Involving Ceiling and Floor Functions

On May 21st 2022, I created a post titled Iterations of a Ceiling Function and the function being dealt with had this form:$$\lceil \sqrt{n} \, \rceil \times (\lceil \sqrt{n}\, \rceil^2 – n) $$The iteration, with output becoming the new input, leads to zero or a loop although this hasn't been rigorously proved. The number associated with my diurnal age today, 26872, has this property. The trajectory ends in a loop and is as follows:

26872, 3936, 2079, 1702, 2604, 5200, 9417, 18326, 23120, 44217, 64144, 94488, 115808, 161293, 125022, 104076, 81719, 22022, 26671, 36900, 67357, 63180, 81648, 42328, 22248, 37800, 43875, 47250, 59732, 71785, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079

Figure 1 shows the trajectory of 26872 under this iteration.


Figure 1: trajectory of 26872 under the floor iteration

There is an associated function that involves the floor function and it has this form:$$\lfloor \sqrt{n} \, \rfloor \times (n-\lfloor \sqrt{n}\, \rfloor^2) $$When this function is iterated, with output serving as the new input, a loop is also reached:

26872, 49389, 23310, 31312, 59136, 21141, 16820, 23091, 43790, 22781, 42150, 25625, 4000, 1953, 748, 513, 638, 325, 18, 8, 8

Figure 2 shows the trajectory of 26872 under the floor iteration.


Figure 2: trajectory of 26872 under ceiling iteration

Here is a permalink to an algorithm that will confirm these two trajectories. Numbers like 26872 that do not end in zero under both iterations but instead end in loops are members of OEIS A219963:


 A219963

Numbers n which do not reach zero under either of the iterations: \( n \rightarrow \lfloor \sqrt{n} \rfloor \times  (n - \lfloor \sqrt{n}) \rfloor\ ^2) \) or  \( n \rightarrow \lceil \sqrt{n} \rceil \times ( \lceil \sqrt{n} \rceil ^2- n ) \).



Not surprisingly, these numbers are rather rare. Here are the initial members of the sequence:

2897, 3159, 3183, 4004, 6335, 7025, 8163, 8237, 8621, 9234, 12204, 12963, 13381, 14340, 15217, 16191, 16438, 17474, 17763, 17972, 18065, 18990, 19677, 19848, 20345, 20803, 21426, 21539, 22022, 25834, 26872, 27175, 28052, 28929, 28996, 29295, 30511, 30991

The first pair of consecutive integers belonging to this sequence is (89971, 89972). As with all these sorts of trajectories, the issue of records arise. For example, what number produces the longest sequence? What number produces the maximum peak? The calculation at each step of the algorithm seems somewhat processor intensive so that calculations over large ranges cause it to time out (on SageMathCell at least). Still, these are interesting statistics to explore. It will be 303 days before my diurnal age again matches a member of this sequence.

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. 

Friday, 21 October 2022

Non-attacking Queens

 I came across this interesting tweet today. Figure 1 shows a snapshot of it.

Figure 1

Here is the Python code that was used:

from itertools import permutations

col = range(8)

for vec in permutations(col):

    if (8 == len(set(vec[i]+i for i in col) == len(set(vec[i]-i for i in col))):

        print(vec)

The algorithm works perfectly well. Here is the output:

(0, 4, 7, 5, 2, 6, 1, 3)
(0, 5, 7, 2, 6, 3, 1, 4)
(0, 6, 3, 5, 7, 1, 4, 2)
(0, 6, 4, 7, 1, 3, 5, 2)
(1, 3, 5, 7, 2, 0, 6, 4)
(1, 4, 6, 0, 2, 7, 5, 3)
(1, 4, 6, 3, 0, 7, 5, 2)
(1, 5, 0, 6, 3, 7, 2, 4)
(1, 5, 7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 0, 5, 1, 4, 6, 3)
(7, 3, 0, 2, 5, 1, 6, 4)

In this output, 0 represents the first or bottom row, 1 the second and so on. The case of [0, 6, 3, 5, 7, 1, 4, 2], shown in the tweet, is highlighted above in bold red. I use the Mathematics specific SageMathCell which is built on top of Python and when using this the permutation function is built in (so no need to import) but it uses a capital P. Similarly, the set function uses a capital S. I've modified the code accordingly and have outputted the number of acceptable configurations. Here is the code (permalink):

L=[]
count=0
col = range(8)
for vec in Permutations(col):
    if (8 == len(Set(vec[i]+i for i in col)) == len(Set(vec[i]-i for i in col))):
        count+=1
        L.append(vec)
print("There are",count,"number of ways to arrange 8 non-attacking queens on a chessboard. They are:")
print()
for n in L:
    print(n)

The output is the same as for the Python code except that it displays the fact that there are 92 possible configurations (out of a total of 40320).

So what's going on in this algorithm. Well, let's start with col = 0, 1, 2, 3, 4, 5, 6, 7. Whatever our permutation, the elements in this range get added and subtracted sequentially to the elements in our permutation. Let's use [5, 2, 4, 6, 3, 0, 7, 1] as an example of a permutation that does equate to a successful configuration. This is shown in Figure 2 (created using a Google Worksheet). Note how the top row (Added) and the bottom row (Subtracted) each contain eight distinct numbers so that the set of both rows has a length of 8.

Figure 2

Let's now consider the permutation [5, 2, 4, 6, 3, 0, 7, 1] that does not lead to a successful configuration. This is shown in Figure 3 where it can be noted that both the top and bottom rows each contain duplicate numbers so that the length of the set is not equal to 8.

Figure 3

 It's quite a succinct and clever algorithm and it's easily modifiable to accommodate any size chess board. To investigate this further it's best to modify the algorithm slightly so that it's more flexible. Here we replace the number 8 with a variable called "size". Here is the modified algorithm with size = 7 (permalink).

L=[]
size=7
count=0
col = range(size)
for vec in Permutations(col): 
    if (size == len(Set(vec[i]+i for i in col))== len(Set(vec[i]-i for i in col))):
        count+=1
        L.append(vec)
print("There are",count,"number of ways to arrange",size,"non-attacking queens on a chessboard. They are:")
print()
for n in L:
    print(n)

The output reveals that there are 40 ways (out of a total of 5040) in which 7 non-attacking queens can be placed on a 7 x 7 chessboard. Here is the output:

 There are 40 number of ways to arrange 7 non-attacking queens on a chessboard. They are:

[0, 2, 4, 6, 1, 3, 5]
[0, 3, 6, 2, 5, 1, 4]
[0, 4, 1, 5, 2, 6, 3]
[0, 5, 3, 1, 6, 4, 2]
[1, 3, 0, 6, 4, 2, 5]
[1, 3, 5, 0, 2, 4, 6]
[1, 4, 0, 3, 6, 2, 5]
[1, 4, 2, 0, 6, 3, 5]
[1, 4, 6, 3, 0, 2, 5]
[1, 5, 2, 6, 3, 0, 4]
[1, 6, 4, 2, 0, 5, 3]
[2, 0, 5, 1, 4, 6, 3]
[2, 0, 5, 3, 1, 6, 4]
[2, 4, 6, 1, 3, 5, 0]
[2, 5, 1, 4, 0, 3, 6]
[2, 6, 1, 3, 5, 0, 4]
[2, 6, 3, 0, 4, 1, 5]
[3, 0, 2, 5, 1, 6, 4]
[3, 0, 4, 1, 5, 2, 6]
[3, 1, 6, 4, 2, 0, 5]
[3, 5, 0, 2, 4, 6, 1]
[3, 6, 2, 5, 1, 4, 0]
[3, 6, 4, 1, 5, 0, 2]
[4, 0, 3, 6, 2, 5, 1]
[4, 0, 5, 3, 1, 6, 2]
[4, 1, 5, 2, 6, 3, 0]
[4, 2, 0, 5, 3, 1, 6]
[4, 6, 1, 3, 5, 0, 2]
[4, 6, 1, 5, 2, 0, 3]
[5, 0, 2, 4, 6, 1, 3]
[5, 1, 4, 0, 3, 6, 2]
[5, 2, 0, 3, 6, 4, 1]
[5, 2, 4, 6, 0, 3, 1]
[5, 2, 6, 3, 0, 4, 1]
[5, 3, 1, 6, 4, 2, 0]
[5, 3, 6, 0, 2, 4, 1]
[6, 1, 3, 5, 0, 2, 4]
[6, 2, 5, 1, 4, 0, 3]
[6, 3, 0, 4, 1, 5, 2]
[6, 4, 2, 0, 5, 3, 1]

These numbers (92 for \(n\)=8, 40 for \(n\)=7 etc.) constitute OEIS A000170:


 A000170

Number of ways of placing \(n\) nonattacking queens on an \(n \times n\) board.       


The initial members of the sequence are:

  • \(n=0\) --> \(1\)
  • \(n=1\) --> \(1\)
  • \(n=2\) --> \(0\)
  • \(n=3\) --> \(0\)
  • \(n=4\) --> \(2\)
  • \(n=5\) --> \(10\)
  • \(n=6\) --> \(4\)
  • \(n=7\) --> \(40\)
  • \(n=8\) --> \(92\)
  • \(n=9\) --> \(352\)
  • \(n=10\) --> \(724\)
  • \(n=11\) --> \(2680\)
  • \(n=12\) --> \(14200\)
  • \(n=13\) --> \(73712 \)
One might struggle with the concept of a 0 x 0 sized chessboard but I guess it's a bit like 0!=1 and 1!=1. The algorithm, when run on SageMathCell, timed out for the cases of \(n=10\) and above.

Thursday, 20 October 2022

A History of Tweets

Each day I tweet about the number associated with my diurnal age but I rarely look back at any of these tweets, especially now that they just represent a summary of a far more detailed analysis that I have stored on my AirTable databases (Diurnal Age Part 1 and Diurnal Age Part 2). 

However, this was not always the case and intially my daily tweet was the only record I retained of my analysis. I discovered a site (https://www.allmytweets.net/) that allows you to easily look back at all your previous tweets and it was interesting to look back at my very first tweet on April 30th 2015. See Figure 1.

Figure 1

Short and sweet but this was back in the days where only 140 characters were allowed. It was only on November 8th 2017 that Twitter increased the limit to 280 characters. This is the OEIS sequence to which the tweet refers:


 A109724

Sum of the first \(n^2\) primes.                                                                   


The initial members of the sequence are:

0, 2, 17, 100, 381, 1060, 2427, 4888, 8893, 15116, 24133, 36888, 54169, 77136, 106733, 144526, 191755, 249748, 320705, 406048, 507825, 627294, 768373, 931686, 1119887, 1336090, 1583293, 1864190, 2180741, 2536646, 2935471, 3380980

In the case of 24133, \(n\) has the value 10. I didn't tweet the next day but did for 24135 and then I missed another day and tweeted for 24137. After that I kept tweeting for every day without fail until the day of this post. The tweets were not exclusively mathematical in those days. It was only on August 6th 2016 (24588) that the tweets became solely mathematical.

I'll still keep tweeting, old habits die hard, even though my AirTable database and my mathematical blog (Mathematical Meanderings) are the foci of my mathematical analysis these days.

Of course I was counting days long before I started tweeting about them. Here is a graphic I created to celebrate being 22222 days old. This occurred on Thursday, February 4th 2010!

Wednesday, 19 October 2022

What's Special About 26862?

As my diurnal age today is 26862, I thought it worthy of some detailed analysis. Recently I've started to give such palindromic days posts of their own. For example:

I've also made several posts about palindromes in general:
So let's get started on 26862. To begin with it's what I call a five digit “balanced” number. By this I mean a number such that the sum of the first two digits equals the middle digit and the sum of the last two digits equals the middle digit. There are 330 numbers with this property but only 45 of them are palindromes (permalink). The palindromes are:

10101, 11211, 12321, 13431, 14541, 15651, 16761, 17871, 18981, 20202, 21312, 22422, 23532, 24642, 25752, 26862, 27972, 30303, 31413, 32523, 33633, 34743, 35853, 36963, 40404, 41514, 42624, 43734, 44844, 45954, 50505, 51615, 52725, 53835, 54945, 60606, 61716, 62826, 63936, 70707, 71817, 72927, 80808, 81918, 90909
Thus in the case of 26862 we have:$$ \underbrace{2 \, 6}_{2+6=8} \, 8 \, \underbrace{6 \, 2}_{6+2=8}$$The palindromes in particular that have 8 as the central digit are:
  • 17871
  • 26862
  • 35853
  • 44844
  • 53853
  • 62862
  • 71871
  • 80808
All eight palindromes and thus linked to the famous 888.

About 90% of numbers can be expressed as sum of two palindromes and 26862 is such a number. It can be represented as a sum of two distinct palindromes in 31 different ways (permalink). If the two palindromes don't need to be unique then we can add 13431+13431 for a total of 32. The palidromes are:
[10001+16861], [10101+16761], [10201+16661], [10301+16561], [10401+16461], [10501+16361], [10601+16261], [10701+16161], [10801+16061], [11011+15851], [11111+15751], [11211+15651], [11311+15551], [11411+15451], [11511+15351], [11611+15251], [11711+15151], [11811+15051], [12021+14841], [12121+14741], [12221+14641], [12321+14541], [12421+14441], [12521+14341], [12621+14241], [12721+14141], [12821+14041], [13031+13831], [13131+13731], [13231+13631], [13331+13531], [13431+13431]

However, of these 31, there are only four pairs in which both numbers are prime (permalink). These are:

[10301+16561], [10501+16361], [11311+15551], [11411+15451]

This property of the number qualifies it for membership in OEIS A356854:


A356854



Palindromes that can be written in more than one way as the sum of two distinct palindromic primes.

Here are is the list of sequence members up to 40,000:

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

All numbers can be represented as a sum of three palindromes and there are 190 ways to do so with 26862. I won't list them all here but one example is 161 + 949 + 25752.

The number 26862 is not only symmetric internally but also externally in a number of ways. To begin with it is sandwiched between two primes and is thus the average of the two:$$\underbrace{26861}_{\text{prime}} \, 26862 \, \underbrace{26863}_{\text{prime}}$$Furthermore, it is also a practical number that is the average of the previous practical number (two below it) and the next practical number (two above it). Practical numbers are always even. Thus we have:$$\underbrace{26860}_{\text{practical}} \, \underbrace{26862}_{\text{practical}} \, \underbrace{26864}_{\text{practical}} $$These prime number and practical number properties qualify 26862 for membership in OEIS A209236:


A209236

List of integers m>0 with m-1 and m+1 both prime, and m-2, m, m+2 all practical.

Such numbers are few and far between. Here is the list of sequence members up to 100,000:

4, 6, 18, 30, 198, 462, 1482, 2550, 3330, 4422, 9042, 11778, 26862, 38610, 47058, 60258, 62130, 65538, 69498, 79902, 96222

Even triples of practical numbers are infrequent as can be seen from the initial sequence members of OEIS A287682:


A287682



Triples of practical numbers: numbers n such that n-2, n, n+2 are all practical numbers.

Here are the members up to 40,000:

4, 6, 18, 30, 198, 306, 462, 702, 1482, 2550, 3330, 4422, 5778, 6102, 6498, 9042, 11178, 11778, 14418, 15498, 17298, 17442, 19458, 20862, 21582, 22878, 23322, 23550, 25230, 26622, 26862, 26910, 27378, 30210, 34542, 36738, 38610, 39006, 39102

So these are just a few ways in which 26862 is special and their combination of course makes the number unique.

Tuesday, 18 October 2022

More About Munchausen Numbers

On September 22nd 2022, I made a post titled "What's Special About 3435?" in which it was revealed that 3435 was the only Munchausen number in base 10, apart from the trivial case of 1. It has the property that \(3^3+4^4+3^3+5^5=3435\). The convention \(0^0=1\) is being applied whenever a zero is encountered in a number. Using this convention, Figure1 shows the Munchausen numbers in bases from 2 to 10.

Source
Let's look at the Munchausen numbers for base 4:$$29_{10}=131_4=1^1+3^3+1^1\\55_{10}=313_4=3^3+1^1+3^3$$Getting back to Munchausen numbers in base 10, I got to thinking about numbers that differed by only 1 under the \( \text{digit}^{\text{digit}} \) sum. This yielded an interesting result in the range up to 100 million (permalink):

32 --> 31
3153 --> 3152
6255 --> 6254
870206 --> 870205
1647371 --> 1647370
1647372 --> 1647373

We can see that 1647371 gives a result that is one below the number while the next consecutive number 1647372 gives a result that is one above the number. The result is that the averages are the same:$$\frac{1647371+1647372}{2}=\frac{1647370+1647373}{2}=1647371.5$$I thought that was a pretty interesting result. 

Another variation is to consider squares and cubes of numbers and beyond. By this I mean what numbers have the property that:$$ \text{number}^n=\sum(\text{digit}^{\text{digit}})$$where \(n\) can equal 1, 2, 3 etc.

So far we've only considered the case of \(n=1\). What about if \(n=2\)? In the range up to ten million, we find only the numbers 1, 2 and 216 satisfying the condition (permalink):
$$ \begin{align}\textbf{1}^2&= 1^1 \\

\textbf{2}^2 &= 2^2 \\
\textbf{216}^2 &= 2^2+1^1+6^6 \end{align} $$What about cubes? Here we find, again in the range up to ten million, that only 1, 3, 36 and 729 qualify (permalink):$$ \begin{align} \textbf{1}^3&= 1^3\\ \textbf{3}^3&= 3^3 \\ \textbf{36}^3 &= 3^3+6^6\\ \textbf{729}^3 &= 7^7+2^2+9^9 \end{align}$$Perhaps we could term such numbers Munchausen numbers of the second order (for squares), Munchausen numbers of the third order (for cubes) and so on.  I thought this was an interesting variation on the original theme. Obviously one could go on and look at higher orders but I'll stop at 3.

Triplets of Disjoint Twin Primes

Today, having turned 26861 days, I noticed that it formed the smaller of a pair of twin primes but more than that it had a special property that qualified it for membership of OEIS A035791:


 A035791

Start of a string of exactly 3 consecutive (but disjoint) pairs of twin primes.



The requirement that the three pairs be disjoint disqualifies prime pairs like (101, 103), (103, 107) and (107, 109) because of the 103 and 107 overlap. It turns out that such triplets of twin primes are relatively rare. The previous was 21587 and the next will be 49367! 

I managed to get SageMathCell to generate the OEIS sequence up to 100,000,000 as well as a table showing the record gaps between the first prime of the first prime pair and the last prime of the last prime pair. The table is shown in Figure 1 below in the range up to 100,000,000:

Figure 1: permalink

As can be seen, 26861 holds the equal record gap of 32 with the next member (49367) creating a new record of 44. The members of the sequence up to one million are shown below:

5, 179, 809, 3359, 4217, 6761, 9419, 9431, 18041, 21587, 26861, 49367, 62969, 62981, 67187, 72221, 72227, 80447, 82721, 91127, 97841, 98897, 103967, 109829, 122597, 154157, 178037, 203321, 208931, 225749, 227609, 236867, 243671, 251201, 266447, 285611, 289109, 295871, 317729, 330287, 342047, 358877, 375251, 392261, 392267, 397517, 402329, 405047, 420809, 422087, 440549, 444341, 452519, 489911, 495569, 495587, 524507, 524969, 560477, 563411, 565889, 570497, 595139, 622187, 629567, 632297, 636059, 640229, 641519, 651179, 663569, 663581, 670037, 677459, 686009, 690839, 704549, 746507, 753437, 758711, 768167, 773609, 773951, 777389, 795761, 797567, 830309, 831371, 842321, 854897, 873569, 875261, 875981, 907367, 909287, 909299, 909317, 946079, 983429, 994307, 997811

The full range of OEIS sequences are:
  • A035789: Start of a string of exactly 1 consecutive (but disjoint) pairs of twin primes.
  • A035790: Start of a string of exactly 2 consecutive (but disjoint) pairs of twin primes.
  • A035791: Start of a string of exactly 3 consecutive (but disjoint) pairs of twin primes.
  • A035792: Start of a string of exactly 4 consecutive (but disjoint) pairs of twin primes.
  • A035793: Start of a string of exactly 5 consecutive (but disjoint) pairs of twin primes.
  • A035794: Start of a string of exactly 6 consecutive (but disjoint) pairs of twin primes.
  • A035795: Start of a string of exactly 7 consecutive (but disjoint) pairs of twin primes.
For quadruplets and beyond, the numbers are very large except for the first few members of OEIS A035792 (quadruplets) that are below a million: 9419, 62969, 72221, 392261, 495569 and 663569. 

Friday, 7 October 2022

ABABAB Numbers

 This tweet caught my interest:

It's not too hard to prove this is true. Let's begin by writing \(ababab\) in terms of place rather than face values. We get:$$100000a+10000b+1000a+100b+10a+b=101010a+10101b$$Now we just need to show that 37 divides both \(101010 \) and \(10101\). We find that:$$\frac{101010}{37} a+\frac{10101}{37} b=2730a+273b$$Thus indeed does 37 divide every number of the form \(ababab\).

What's interesting is to extend this idea to other patterns, let's say \(abcabc\). Investigating this we find that:$$100000a+10000b+1000c+100a+10b+c=100100a+10010b+1001c$$It's apparent that every number of the form \(abcabc\) is thus divisible by 1001. However, 1001 is factorisable: $$1001=7 \times 11 \times 13$$Thus every number of the form \(abcabc\) is divisible by 7, 11 and 13.

Let's try another one: \(abba\). This gives:$$ \begin{align}1000a+100b+10b+a &= 1001a+110b\\ &=11 \times 91 a + 11 \times 10b \end{align}$$Clearly numbers of this form are divisible by 11. The same is true (pretty obviously) of the pattern aabb where we have:$$\begin{align} 1000a+100a+10b+b&=1100a+11b\\ &=11 \times 100 a+11 \times b \end{align}$$How does this tie in then with the divisibility rule for 11? Well one rule is:

If the difference of the sum of alternative digits of a number is divisible by 11, then that number is divisible by 11 completely.

Let's apply this rule to \(abcabc\), \(abba\) and \(aabb\) which patterns we know are divisible by 11:
  • \(abcabc\) --> \( (a+c+b)-(b+a+c)=0 \)
  • \(abba\) --> \( ( a+b)-(b+a)=0\)
  • \(aabb\) --> \( (a+b)-(a+b)=0\)
Thus the divisibility rules are in conformity with what we already knew.

There  is an inherent ambiguity in presenting numbers in the form of \(ababab\), \(abcabc\), \(abba\), \(aabb\) etc. because algebraically these numbers would be rendered \(a^3b^3\), \(a^2b^2c^2\), \(a^2b^2\) and \(a^2b^2\) respectively. This is because, when writing \(ababab\) for example, the common interpretation is \(a \times b \times a \times b \times a \times b\). 

It might be better to use a tuple, \( (a,b,a,b,a,b) \) and say that it is equivalent to \( a \times 10^5+b \times 10^4+a \times 10^3+b \times 10^2 + a \times 10 +b\). However, I guess things are clear enough if you explicitly state that each pronumeral represents a digit between 0 and 9 and that place as well as face value needs to be taken into consideration..

The patterns of the pronumerals are reminiscent of rhyming schemes in literature and many have specific names e.g. Balliol rhyme AABB. This topic could obviously be investigated more extensively but I'll leave off there for the moment.

Wednesday, 5 October 2022

What's Special About 97?

I have Cliff Pickover to thank for this information about the number 97. Figure 1 shows his tweet on October 4th 2022:

Figure 1

So to reproduce the fine print: 97 is the largest prime that we can find that is less than the sum of squares of its digits. The sum of the squares of the digits is 130 in this case. This fact prompted me to explore what the largest primes are when we consider the cube, fourth powers and so on of the digits. Here is a permalink to an algorithm I developed for investigating this matter; it's set up for digits raised to the sixth power and can be easily modified to test other powers. Here's what I found.
  • 97 is the largest prime for digits raised to the power 2
  • 1,999 is the largest prime for digits raised to the power 3
  • 19,997 is the largest prime for digits raised to the power 4
  • 199,999 is the largest prime for digits raised to the power 5
  • 2,999,999 is the largest prime for digits raised to the power 6
Beyond powers of 8, SageMathCell will time out. Let's get back to the case of 97 being the largest prime that is less than the sum of squares of its digits. If we remove the condition that the number is prime, it turns out that 99 is the largest number that is less than the sum of squares of its digits. This is because every three digit number is greater than the sum of squares of its digits. Put mathematically, we can say that:$$100a+10b+c>a^2+b^2+c^2$$where \(a\) can be any digit between 1 and 9 while \(b\) and \(c\) can be any digits between 0 and 9. This relationship can be rewritten as:$$(100a-a^2)+(10b-b^2)+(c-c^2)>0$$To see why this is true, let's look at the minimum possible value of \(100a-a^2\). This occurs when \(a=1\) and produces a value of 99. Similarly the minimum possible value of \(10b-b^2\) occurs when \(b=0\) and produces a value of zero. \(c-c^2\) has a minimum value when \(b=9\) producing a value of -72. Thus the minimum possible value is +27 and greater than zero.

This inequality does not hold true of course if the digits are raised to the third power. Thus:$$100a+10b+c \text{ can be less than } a^3+b^3+c^3\\ \text{or } (100a-a^3)+(10b-b^3)+(c-c^3)\text{ can be less than }0$$The largest three digit number, 999, is certainly less than the sum of cubes of its digits (2187). We must look at four digit numbers then and find the maximum possible values for \(a,b,c\) and \(d\) such that:$$1000a+100b+10c+d<a^3+b^3+c^3+d^3\\ \ \text{or } (1000a-a^3)+(100b-b^3)+(10c-c^3)+(d-d^3)<0$$It's easy to determine that 1,999 is the largest number that is less than the sum of the cubes of its digits. The number just happens to be prime. Similarly it can be shown that 19,999 is the largest number that is less than the sum of its digits raised to the fourth power. The largest prime is then the nearest prime less than this number and that happens to be 19,997. And so on.