Saturday 26 February 2022

Another Prime Generating Polynomial

 I've posted about prime generating polynomials before, specifically:

In that first post, I included a table taken from MathWorld of the most impressive prime producing polynomials (not necessarily linear or quadratic). See Figure 1.


Figure 1

However, in that table, there's no mention of the fairly impressive prime producing polynomial that generates the sequence of number for OEIS A218456:


 A218456

\(2n^3 - 313n^2 + 6823n - 13633\)                                                                       


In the range of values for \(n\) from -8 to 102, it produces 90 primes out of the 110 numbers constituting an impressive 81.8% of the range. My attention was drawn to this polynomial because the number associated with my diurnal age today (26627) is a prime and a member of this sequence (when \(n\)=12). 

The initial members are:

-13633, -7121, -1223, 4073, 8779, 12907, 16469, 19477, 21943, 23879, 25297, 26209, 26627, 26563, 26029, 25037, 23599, 21727, 19433, 16729, 13627, 10139, 6277, 2053, -2521, -7433, -12671, -18223, -24077, -30221, -36643, -43331, -50273, -57457

Notice that some values are negative so we are considering absolute values here and ignoring the sign. The members of the sequence can be prime or composite. Figure 2 shows a plot of the prime values of the polynomial in the range from -8 to 102. I've chosen this range because values of -9 and 103 produce composite numbers.


Figure 2

The minimum prime produced in the range is 1223 and the maximum is 477551. The polynomial is cubic and Figure 3 shows what it looks like (courtesy of GeoGebra) and it can be seen that most of the values in the range are negative.


Figure 3

However, given that we are  only interested in positive values then the graph of \(y=|2n^3 - 313n^2 + 6823n - 13633|\) is as shown in Figure 4 and reflects what is shown in Figure 1.


Figure 4

Interestingly, 26627 is also a member of another sequence produced by a prime generating polynomial viz. OEIS 


 A320772

Prime generating polynomial: a(\(n\)) = \( (4n - 29)^2 + 58\)                                  
   

The initial members of the sequence are:

683, 499, 347, 227, 139, 83, 59, 67, 107, 179, 283, 419, 587, 787, 1019, 1283, 1579, 1907, 2267, 2659, 3083, 3539, 4027, 4547, 5099, 5683, 6299, 6947, 7627, 8339, 9083, 9859, 10667, 11507, 12379, 13283, 14219, 15187, 16187, 17219, 18283, 19379, 20507, 21667, 22859, 24083, 25339, 26627, 27947

This quadratic polynomial generates 28 distinct primes in succession from \(n\)=1 to 28. 26627 is generated by \(n\)=48. This polynomial is not listed in the table shown in Figure 1. The minimum prime is 59 and maximum is 6947. The graph of the quadratic lies completely above the \(x\) axis so all values generated are positive.

Figure 5 shows the numbers that are generated in the range from -8 to 102 (the same range as for the previous cubic polynomial). As the values exceed 28, it can be seen that the number of primes generated decreases. Overall, the density of primes in the range is 65.5% or 72 out of 110.                        


Figure 5

Wednesday 23 February 2022

Collatz Trajectory Records

I've written about the Collatz Trajectory or the \(3x+1\) Problem previously in the following posts:


The topic was drawn to my attention yet again when I discovered that the number associated with my diurnal age, 26623, was intimately linked the \(3x+1\) problem because of its link to two sequences in the OEIS, specifically:

 
 A006877

In the '3x+1' problem, these values for the starting value set  new records for number of steps to reach 1.   
                                  

1, 2, 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, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935, 626331, 837799, ...

The record set is 307 steps. The full trajectory is as follows:

26623, 79870, 39935, 119806, 59903, 179710, 89855, 269566, 134783, 404350, 202175, 606526, 303263, 909790, 454895, 1364686, 682343, 2047030, 1023515, 3070546, 1535273, 4605820, 2302910, 1151455, 3454366, 1727183, 5181550, 2590775, 7772326, 3886163, 11658490, 5829245, 17487736, 8743868, 4371934, 2185967, 6557902, 3278951, 9836854, 4918427, 14755282, 7377641, 22132924, 11066462, 5533231, 16599694, 8299847, 24899542, 12449771, 37349314, 18674657, 56023972, 28011986, 14005993, 42017980, 21008990, 10504495, 31513486, 15756743, 47270230, 23635115, 70905346, 35452673, 106358020, 53179010, 26589505, 79768516, 39884258, 19942129, 59826388, 29913194, 14956597, 44869792, 22434896, 11217448, 5608724, 2804362, 1402181, 4206544, 2103272, 1051636, 525818, 262909, 788728, 394364, 197182, 98591, 295774, 147887, 443662, 221831, 665494, 332747, 998242, 499121, 1497364, 748682, 374341, 1123024, 561512, 280756, 140378, 70189, 210568, 105284, 52642, 26321, 78964, 39482, 19741, 59224, 29612, 14806, 7403, 22210, 11105, 33316, 16658, 8329, 24988, 12494, 6247, 18742, 9371, 28114, 14057, 42172, 21086, 10543, 31630, 15815, 47446, 23723, 71170, 35585, 106756, 53378, 26689, 80068, 40034, 20017, 60052, 30026, 15013, 45040, 22520, 11260, 5630, 2815, 8446, 4223, 12670, 6335, 19006, 9503, 28510, 14255, 42766, 21383, 64150, 32075, 96226, 48113, 144340, 72170, 36085, 108256, 54128, 27064, 13532, 6766, 3383, 10150, 5075, 15226, 7613, 22840, 11420, 5710, 2855, 8566, 4283, 12850, 6425, 19276, 9638, 4819, 14458, 7229, 21688, 10844, 5422, 2711, 8134, 4067, 12202, 6101, 18304, 9152, 4576, 2288, 1144, 572, 286, 143, 430, 215, 646, 323, 970, 485, 1456, 728, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1

The number marked in bold in the trajectory (106358020) above is the highest value attained and this too sets a new Collatz trajectory record:


 A006884

In the '3x+1' problem, these values for the starting value set new records for highest point of trajectory before reaching 1.

1, 2, 3, 7, 15, 27, 255, 447, 639, 703, 1819, 4255, 4591, 9663, 20895, 26623, 31911, 60975, 77671, 113383, 138367, 159487, 270271, 665215, 704511, 1042431, 1212415, 1441407, 1875711, 1988859, 2643183, 2684647, 3041127, 3873535, 4637979, 5656191

Figure 1 shows a plot of the 307 values from 26623 to 1:


Figure 1

Thursday 17 February 2022

Clark's Triangle

One of the properties of today's number 26618, that marks my diurnal age, is that it is a member of OEIS A100206


 A100206

Row sums of Clark's triangle A046902: Clark's triangle: left border = 0 1 1 1..., right border = multiples of 6; other entries = sum of 2 entries above.


The setup is shown in Figure 1, although it is a mirror image of that described in OEIS A100206 because the borders are reversed. The significance of the \( (m-1)^2\) and the \(n^2\) will be explained shortly.
Figure 1: source
To quote from Figure 1's source:
Clark's triangle is a number triangle created by setting the vertex equal to 0, filling one diagonal with 1s, the other diagonal with multiples of an integer \(f\), and filling in the remaining entries by summing the elements on either side from one row above. Figure 1 above shows Clark's triangle for \(f\)=6.
Call the first column \(n\)=0 and the last column \(m=n\) so that:
$$\begin{align} c_{m \, \scriptsize{0}} &= f\,m\\
c_{m\,m} &= 1 \end{align}$$then use the recurrence relation$$c_{m\,n}=c_{m-\scriptsize{1}, \,\normalsize{n}-\scriptsize{1}}+c_{m-\scriptsize{1}, \,\normalsize{n}}$$to compute the rest of the entries. The result is given analytically by$$c_{m\,n}=f \times \binom{m} {n+1}+\binom{m-1}{n-1}$$where \( \binom{n}{k} \) is a binomial coefficient.
The interesting part is that if \(f\)=6 is chosen as the integer, then 
\( c_{m \, \scriptsize{2}} \) and \(c_{m \, \scriptsize{3}}\) simplify to$$ \begin{align} c_{m \, \scriptsize{2}} &= (m-1)^3\\c_{m \, \scriptsize{3}} &= \dfrac{(m-1)^2(m-2)^2}{4} \end{align}$$which are consecutive cubes \( (m-1)^3 \) and nonconsecutive squares$$n^2=\left ( \dfrac{(m-1)(m-2)}{2} \right )^2$$The sum of the \(m\)-th row for \(m>0\) is given by$$ \sum_{n=0}^{m} c_{m\,n}=2^{m-1}+f \times (2^{m}-1) $$ (M. Alekseyev, pers. comm., Aug. 10, 2005).

 The row sums (of which 26618 is a member and where \(f\)=6) are as follows:

0, 7, 20, 46, 98, 202, 410, 826, 1658, 3322, 6650, 13306, 26618, 53242, 106490, 212986, 425978, 851962, 1703930, 3407866, 6815738, 13631482, 27262970, 54525946, 109051898, 218103802, 436207610, 872415226, 1744830458, 3489660922

Of course there are as many sequences as there are different values of \(f\) but none is listed in the OEIS apart from A100206 where \(f\)=6. In all sequences, the ratio of successive terms rapidly approaches 2.

Friday 11 February 2022

Khinchin's Constant

As I said in my previous post, Twin Prime Constant, the following standard mathematical constants are defined in SageMath:
  • pi
  • golden_ratio
  • log2
  • euler_gamma
  • catalan
  • khinchin
  • twinprime
  • mertens
I'm familiar with all the constants above except two: the twinprime constant and the khinchin constant. I've dealt with the former and so this post is about the latter. To quote from Wikipedia:
Aleksandr Yakovlevich Khinchin proved that for almost all real numbers \(x\), coefficients \(a_i\) of the continued fraction expansion of \(x\) have a finite geometric mean that is independent of the value of \(x\) and is known as ''Khinchin's constant''. That is, for$$x = a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cfrac{1}{\ddots}}}}$$it is almost always true that$$\lim_{n \rightarrow \infty } \left( a_1 a_2 ... a_n \right) ^{1/n} = K_0$$where \(K_0\) is Khinchin's constant which is equal to$$\prod_{r=1}^\infty {\left( 1+{1\over r(r+2)}\right)}^{\log_2 r}  \approx 2.6854520010\dots$$Although almost all numbers satisfy this property, it has not been proven for ''any'' real number ''not'' specifically constructed for the purpose. Among the numbers \(x\) whose continued fraction expansions are known ''not'' to have this property are rational numbers, roots of quadratic equations (including the golden ratio, the square roots of integers) and the base of the natural logarithm \(e\).

\( \pi \), the Euler–Mascheroni constant \( \gamma \), and Khinchin's constant itself, based on numerical evidence, are thought to be among the numbers whose geometric mean of the coefficients \(a_i\) in their continued fraction expansion tends to Khinchin's constant. However, none of these limits have been rigorously established. It is not known whether Khinchin's constant is a rational, algebraic irrational or transcendental number.
Let's look at Wolfram MathWorld's article on the Euler-Mascheroni Constant Continued Fraction in which the continued fraction for \( \gamma \) is given as:

[0; 1, 1, 2, 1, 2, 1, 4, 3, 13, 5, 1, 1, 8, 1, 2, 4, 1, 1, 40, ...] (OEIS A002852)

SageMathCell (permalink) can display what this continued fraction looks like. See Figure 1.

Figure 1: permalink

Figure 2 shows a plot of the progressive harmonic means of successive values of \(a_1^{1/1}, (a_1.a_2)^{1/2}, (a_1.a_2...a_n)^{1/n} \) that appear to approach Khinchin's constant, although this has not been rigorously proven:

Figure 2: source

Figure 2 shows a rather more complicated plot of the values \( (a_1.a_2,...,a_n)^{1/n} \) for \(n\)=1 to 500 and \(x=\pi, \sin 1\), the Euler-Mascheroni constant \( \gamma\), and the Copeland-Erdős constant \(C\). The horizontal line marked \(K\) in the plot is Khinchin's constant.

Figure 2: source

I've mentioned the geometric mean briefly in posts titled Root-Mean-Square And Other Means on September 13th 2020 and Reciprocals of Primes on October 30th 2021. This mean is one of the three Pythagorean means along with the arithmetic and harmonic. I definitely need to dedicate a post to these three means.

Twin Prime Constant

The following standard mathematical constants are defined in SageMath (link):

  • pi
  • golden_ratio
  • log2
  • euler_gamma
  • catalan
  • khinchin
  • twinprime
  • mertens

I'm familiar with all the constants above except two: the twinprime constant and the khinchin constant. In this post, I'll be examining the former but first let's use SageMathCell to approximate the constants in the above list. See Figure 1.


Figure 1: permalink

Figure 2 zooms in a little closer on the output from Figure 1:


Figure 2

So what is the twin prime constant? Well, according to this source, the famous mathematical pair of Hardy and Littlewood conjectured that there are about:$$2  \prod_{p \geq 3} \frac{p(p-2)}{(p-1)^2} \int_2 ^x \frac{ \text{d}x}{(\log{x})^2}  \approx 1.320323632 \int_2 ^x \frac{ \text{d}x}{(\log{x})^2}$$twin primes less than or equal to \(x\) where the infinite product is the twin prime constant. In other words, the twin prime constant is given by$$\prod_{p \geq 3} \frac{p(p-2)}{(p-1)^2} \approx 0.66016181584686957393$$The  agreement between the calculated number of twin primes and the actual number gets better and better as \(x\) gets larger. Figure 3 shows the progression:


Figure 3

This is a complex topic and I won't go any deeper into here, as my intention was simply to explain what the constant represents and how it arises.

Thursday 10 February 2022

Super-d Numbers

So-called super-d numbers keep popping up in Numbers Aplenty from time to time in specific forms like super-2 numbers, super-3 numbers etc. I've ignored them for reasons that I'll explain later. Today I turned 26611 days old and one the properties of this number is that it's a super-3 number meaning that \( {\small 3 \times 26611^3} \) contains \( {\small 333} \) as a substring:$$3 \times 26611^3=565 \underline{333}65411393$$I've been mistakenly thinking that the number was the exponent and that I was dealing with \( {\small 3 \times 3^{26611}} \). Naturally, with such an enormous number, it would be likely that \( {\small 333} \) would occur. Now that I've recognised my error, I'm creating this post to make amends for my neglect. In general:$$ \text{ a super-d number is a number } n \text{ for }d=2, \dots ,9\\ \text{ such that  } d\cdot n^d \text{ contains a substring made of } d  \text{ digits of } d$$The first super-2 number is 19 where \( {\small 2 \times 19^2=7\underline{22} }\) and the first super-3 number is 261 where \( {\small 3 \times 261^3=5\underline{333}8743 }\).

Figure 1 shows a list of the initial super-d numbers:

Figure 1: source

Up to 1000 the super-d numbers are:

19, 31, 69, 81, 105, 106, 107, 119, 127, 131, 169, 181, 190, 219, 231, 247, 261, 269, 281, 310, 318, 319, 331, 332, 333, 334, 335, 336, 337, 338, 339, 348, 369, 381, 419, 431, 454, 462, 469, 471, 481, 511, 519, 531, 558, 569, 581, 601, 619, 631, 669, 679, 681, 690, 715, 719, 731, 739, 749, 753, 769, 781, 782, 783, 784, 810, 819, 831, 869, 881, 919, 928, 931, 944, 969, 981, 988
Figure 2 shows the first few palindromic super-d number for small d:

Figure 2: source

It has been shown that all numbers ending in 471, 4710, or 47100 are super-3 numbers. For example:$$3 \times 47100^3=313461\underline{333}000000 $$Figure 3 shows that the spiral pattern of super-d numbers up to \( {\small 250^2} \) contains some long runs of consecutive terms.

Figure 3: source

Tuesday 8 February 2022

More Wordle Statistics

My last post titled Wordle Statistics was long enough so I didn't want to add more newly found information to that and hence I'm making a fresh post. 3Blue1Brown has just created a YouTube video that involves a statistical analysis of Wordle.


There's a lot to digest in this video but my main takeaway after first viewing it was that CRANE was a good starting word! I clearly need to watch it again and again to fully absorb what he's saying. However, for today's Wordle I started with CRANE and the results were almost disastrous as can be seen in Figure 1.


Figure 1

Looking at Figure 1, it can be seen that I had a spectacular start with three letters in the correct positions. There were only two remaining letters to guess. However, I nearly failed because there were just so many possible words that could be made from *RA*E. 

Referring to kaggle, a database of English word frequencies, we can see that TRADE was a good second choice because it has by far the highest frequency. Had I known about word frequencies, my third choice would have been FRAME and I would have solved the puzzle in a mere three attempts.

CRANE: 4,888,961 FIFTH

                                        TRADE: 110,086,585 FIRST

                                        ERASE: 3,086,642 SIXTH

                                        GRACE: 17,642,126 THIRD

BRAKE: 9,321,885 FOURTH

                                        FRAME: 46,079,991 SECOND 

Using Google search with quotes e.g. "trade" yields the following statistics:

CRANE: 166,000,000 SIXTH

                                         TRADE: 1,930,000,000 SECOND

                                         ERASE:  242,000,000 FIFTH

                                         GRACE:  918,000,000 THIRD

 BRAKE:  503,000,000 FOURTH

                                         FRAME:   2,350,000,00 FIRST

Interestingly, using the Google search, FRAME and TRADE swap places with the former being markedly more frequent (in searches at least). CRANE and ERASE also swap positions in fifth and sixth places.

I downloaded the CSV file of word frequencies from kaggle (it's only 5MB) and filtered out words that were not five letters in length. Here are the initial five letter words with the highest frequencies:

about 1,226,734,006

other 978,481,319

which 810,514,085

their         782,849,411

there 701,170,205

first         578,161,543

would 572,644,147

these 541,003,982

click         536,746,424

price         501,651,226

state         453,104,133

email 443,949,646

world 431,934,249

music 414,028,837

after         372,948,094

video 365,410,017

where 360,468,339

books 347,710,184

links         339,926,541

years 337,841,309

As can be seen, ABOUT comes out clearly on top with a frequency of over 1.2 billion! This might not be a bad starting word. Anyway, more food for thought went tackling Wordle.

Monday 7 February 2022

Wordle Statistics


In my Pedagogical Posturing blog, I recently posted about Wordle but in post I want to focus on the statistics of the letter frequencies. Of primary interest of course is how frequently the various letters of the alphabet occur within the Wordle "universe". In A Mathematician's Guide to Wordle, it's explained that:

Wordle has both a ‘source’ word list and a ‘target’ word list. You can guess anything from the source word list (which is the 5 letter words from CSW19) ... The target word list is a small hand-curated subset of less than 2500 of these words.

CSW stands for Collins Scrabble Words that consists of 279,496 words. The article just quoted from goes on to say that:

It is well known that when you order letters by frequency of appearance in English words, you get ETAOIN SHRDLU. However ... if you take all 5 letter words in CSW19, you get SEAORY LTNUDY.

Figure 1 shows the full sequence of letters and their relative frequencies. The commentary on this chart includes:

  • In fact, they're essentially tied, S appearing only three more times than E in the 64,860 letters in the word list. That's a 0.0046 percentage point difference.

  • After those two, the distribution doesn't fall off that much. A is 9.2%, O is 6.8%, R is 6.4%.

  • The top 10 most frequent letters in the list make up 67% of the occurrences. That's all five vowels, plus the Wheel of Fortune consonants, R S T L N.

  • For those of you wondering about that "other" vowel, Y is 12th at 3.2%.

  • The least common 5 letters, Q X J Z V, combine for a mere 2.8% of the occurrences, about the same as the letter H, the 16th ranked letter.

  • The most common letter, S, is overwhelmingly more likely to be in fifth position (59%). Otherwise, it's more likely that it appears first (23%) than in any of the middle positions combined.

  • Vowels occur most commonly in the second position. That is unless you're E, which is more common in the fourth spot (35%) than second (24%). Again, "-ed" words are a plausible explanation.

  • For you Y fans: The pseudo-vowel shows up in the last spot 63% of the time when it appears.

  • Of the most common letters, L has the most level distribution, appearing most in the third position (25%) and least in the last position (14%).

  • Words in which letters appear twice make up a little more than 35.8% of the accepted word list.


Figure 1: source

Looking at Figure 1, it would seem that the AROSE would be a good starting point. Figure 2 shows the positions within a word of the most common letters.


Figure 2: source

Figure 2 shows that S occurs most frequently in the final position and so the previous choice of AROSE is perhaps not as good a choice as it first seemed. There are no permutations of this word that have S in the final position. Finally Figure 3 shows the frequency of letters occurring twice in a word compared with their overall frequency.


Figure 3: source

Given that both E are S more likely to occur twice in a word, it would seem that EASES might be good choice of starting word. Some other suggested starting words are:

  • TARES
  • SORES
  • CARES
  • CORES
  • REAIS
  • BLAHS
  • SOLAR
There are a lot of factors to consider but this post is at least a start and will definitely improve my Wordle prowess.

Saturday 5 February 2022

Apocalyptic Numbers


X-Men: Apocalypse (2016)

Numbers Aplenty has to say about apocalyptic numbers:

A number of the form \(2^n\) is called apocalyptic if its digits contain "666" as a substring. The smallest apocalyptic number is \(2^{157}\), which is equal to:$$182687704\underline{666}362864775460604089535377456991567872$$while \(2^{220}\) is the smallest apocalyptic number which contains two 666 groups, being equal to:$$ {\tiny 168499\underline{66666}969149871\underline{666}88442938726917102321526408785780068975640576} $$The smallest power of 2 with 3 groups is \(2^{931}\).

A number \(n\) such that \(2^n\) is apocalyptic is called an apocalyptic power or apocalyptic exponent.

Between \(1\) and \(3 \times 10^6\) there are 3715 numbers which are non-apocalyptic exponents, the largest being 29784. In other words, it is highly probable that \(2^n\) for \(n \ge 29785\) is an apocalyptic number.

Probably there are only 8 numbers, namely 2666, 3666, 5666, 6660, 6665, 6669, 11666, 26667 which contains 666 among their digits but are not apocalyptic exponents.

The first apocalyptic exponents are 157, 192, 218, 220, 222, 224, 226, 243, 245, 247, 251, 278, 285, 286, 287, 312, 355, 361, 366, 382, 384, 390, 394, 411, 434, 443, 478, 497, 499, 506, ...

Here is a link to the first 1000 apocalyptic exponents. As the numbers get larger, the frequency of numbers being non-apocalyptic exponents decreases so that, after 29874, the frequency is (probably) zero. For example, in the range from 20000 to 30000, there are only the following non-apocalyptic exponents:

20271, 20300, 20509, 20644, 20710, 21077, 21600, 21602, 22447, 22734, 23097, 23253, 24422, 24441, 25026, 25357, 25896, 26051, 26667, 29784

Why this interest in apocalyptic numbers? Well, in my diurnal age count, I've entered what might be termed an "apocalyptic phase". I'm currently 26606 days old and heading toward 26666 (the latter occurs a day before my 73rd birthday). Interestingly, as can be seen in the range of numbers above, 26667 is the second last non-apocalyptic exponent.

Numbers Aplenty also shows the smallest 3 × 3 magic square made of consecutive apocalyptic numbers. See Figure 1.

Figure 1

The apocalyptic powers comprise OEIS A007356:


 A007356

Apocalyptic powers: \(2^n\) contains \(666\).                           
                                

Finally, let's not forget that:
Georg Cantor was born on the 3rd March 1845 in St Petersburg, Russia, and died on the 6th January 1918 in Halle, Germany. At the time of this death, he was 72 years 10 months and 3 days old or 72.85 years of age which is equivalent to 26606 days.

Georg Cantor

This is the exact age that I am today.