Saturday, 23 November 2019

Cyclic Numbers

To quote from the source of all wisdom, Wikipedia:
A cyclic number is an integer in which cyclic permutations of the digits are successive integer multiples of the number. The most widely known is the six-digit number 142857, whose first six integer multiples are 
142857 × 1 = 142857
142857 × 2 = 285714
142857 × 3 = 428571
142857 × 4 = 571428
142857 × 5 = 714285
142857 × 6 = 857142
To qualify as a cyclic number, it is required that consecutive multiples be cyclic permutations. Thus, the number 076923 would not be considered a cyclic number, because even though all cyclic permutations are multiples, they are not consecutive integer multiples: 
076923 × 1 = 076923
076923 × 3 = 230769
076923 × 4 = 307692
076923 × 9 = 692307
076923 × 10 = 769230
076923 × 12 = 923076 
If leading zeros are not permitted on numerals, then 142857 is the only cyclic number in decimal, due to the necessary structure given in the next section. Allowing leading zeros, the sequence of cyclic numbers begins: 
(\(10^6-1\)) ÷ 7 = 142857 (6 digits)
(\(10^{16}-1\)) ÷ 17 = 0588235294117647 (16 digits)
(\(10^{18}-1\)) ÷ 19 = 052631578947368421 (18 digits)
(\(10^{22}-1\)) ÷ 23 = 0434782608695652173913 (22 digits)
(\(10^{28}-1\)) ÷ 29 = 0344827586206896551724137931 (28 digits)
However, it was in the realm of repeating decimals that I first encountered cyclic numbers. Specifically, I was looking at OEIS entries for 25801, a number representing my diurnal age at the time of composing this blog post, and I came across this entry:
A056215: primes \(p\) for which the period of reciprocal = \( \displaystyle \frac{p-1}{10} \) 
281, 521, 1031, 1951, 2281, 2311, 2591, 3671, 5471, 5711, 6791, 7481, 8111, 8681, 8761, 9281, 9551, 10601, 11321, 12401, 13151, 13591, 14831, 14951, 15671, 16111, 16361, 18671, 21191, 21521, 21881, 24281, 24551, 25391, 25801, ...
Sure enough, when I checked on SageMathCell, the period of this reciprocal is indeed 2580 (see Figure 1):

Figure 1: permalink

After 2580 decimal places, the digits do repeat (shown in red):

0.0000387581876671446843145614511065462578969807371807294290918956629588000465098252005736211774737413278555094763768846168753149102747955505600558117902406883454129684895934266113716522615402503778923297546606720669741482888260144955621875121119336459827138483004534707957055928064803689779465912173946746250145343203751792566179605441649548467113677764427735359094608736095500174411844502151079415526529979458160536413317313282430913530483314600209294213402581295298631835975349792643695980775938917096236579977520251153056083097554358358203170419751172435176931126700515483895973024301383667299717065230029843804503701406922212317352040618580675167629161660400759660478276035812565404441688306654780822448742296810201154993992480911592573931242975078485330025967985736986938490756172241385992790977093911088717491570094182396031161582884384326188907406689663191349172512693306460989884113018875237393899461261191426688888027595829619007015231967753187860935622650284872679353513429712026665633114995542808418278361303825433122747180341847215224216115654431998759737994651370101934033564590519747296616410216658269059338785318398511685593581644122320840277508623696755939692259989922871206542382078214022712297972946785008333010348436107127630711987907445447850858493856827254757567536142009999612418123328553156854385488934537421030192628192705709081043370411999534901747994263788225262586721444905236231153831246850897252044494399441882097593116545870315104065733886283477384597496221076702453393279330258517111739855044378124878880663540172861516995465292042944071935196310220534087826053253749854656796248207433820394558350451532886322235572264640905391263904499825588155497848920584473470020541839463586682686717569086469516685399790705786597418704701368164024650207356304019224061082903763420022479748846943916902445641641796829580248827564823068873299484516104026975698616332700282934769970156195496298593077787682647959381419324832370838339599240339521723964187434595558311693345219177551257703189798845006007519088407426068757024921514669974032014263013061509243827758614007209022906088911282508429905817603968838417115615673811092593310336808650827487306693539010115886981124762606100538738808573311111972404170380992984768032246812139064377349715127320646486570287973334366885004457191581721638696174566877252819658152784775783884345568001240262005348629898065966435409480252703383589783341730940661214681601488314406418355877679159722491376303244060307740010077128793457617921785977287702027053214991666989651563892872369288012092554552149141506143172745242432463857990000387581876 ...

Now the Wikipedia article states that:
If the digital period of \( \displaystyle \frac{1}{p}\) where \(p\) is prime is \(p − 1\), then the digits represent a cyclic number.
That clearly isn't the case with 25801. However, in the comments to the OEIS entry, it states:
Cyclic numbers of the tenth degree (or tenth order): the reciprocals of these numbers belong to one of ten different cycles. Each cycle has the following number of digits: 
\( \displaystyle \frac{number- 1}{10} \)
So 25801 is not a prime that produces a cyclic number. The nearest smaller prime that does this is 25793 and the nearest larger prime that does this is 25847. The primes that produce cyclic numbers are known as reptend primes. In this regard, Wikipedia states that:
Cyclic numbers are related to the recurring digital representations of unit fractions. A cyclic number of length \(L\) is the digital representation of: 
\(\displaystyle \frac{1}{L + 1} \)
Conversely, if the digital period of \( \displaystyle \frac{1} {p} \), where \(p \) is prime, is \(p-1\), then the digits represent a cyclic number. 
For example: 
\( \displaystyle \frac{1}{7}\) = 0.142857 142857…. 
Multiples of these fractions exhibit cyclic permutation: 

\( \displaystyle \frac{1}{7}\) = 0.142857 142857…


\( \displaystyle \frac{2}{7}\) = 0.285714 285714…


\( \displaystyle \frac{3}{7}\) = 0.428571 428571…


\( \displaystyle \frac{4}{7}\) = 0.571428 571428…


\( \displaystyle \frac{5}{7}\) = 0.714285 714285…


\( \displaystyle \frac{6}{7}\) = 0.857142 857142….


Checking reveals the nearby primes to 25801, namely 25793 and 25847, do have periods of 25792 and 25846 respectively. These periods are decimal maximal periods, the maximum length that a repeating decimal of this form can have. See Figure 2.

Figure 2: permalink

I accidentally typed in 258487 when checking and it turns out that the period of its reciprocal is 258486 and so it is a reptend prime as well. However, as stated earlier, 25801 is not a reptend but is regarded as a cyclic number of the tenth degree or tenth order. The terminology can get confusing. Let's start again with the reptend primes. These are also referred to as long period primes and form part of a categorisation involving different values of \(k\):$$\text{Primes }p \text{ such that the period of }\displaystyle \frac{1}{p} \text{ is } \displaystyle \frac{p-1}{k} \text{ where }k=1,2,3,4, ...$$The sequences generated by applying these formulae are listed in the cross references for the original OEIS A056215 entry:
A006883, A097443, A055628, A056157, A056210, A056211, A056212, A056213, A056214, A056215, A056216, A056217, A098680, which are sequences of primes \(p \) where the period of the reciprocal is \( \displaystyle \frac{p-1}{k}\) for \(k=1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13\) respectively.
So I think my confusion has been clarified. It is only when \(k=1\) that the reciprocal produces a cyclic number. The Wikipedia goes on to state that:
From the relation to unit fractions, it can be shown that cyclic numbers are of the form of the Fermat quotient:$$ \displaystyle \frac {b^ {\,p-1}-1}{p}$$ where \(b\) is the number base (10 for decimal), and \(p\) is a prime that does not divide \(b\). Primes \(p\) that give cyclic numbers in base \(b \) are called full reptend primes or long primes in base \(b\). 
For example, the case \(b = 10\), \(p = 7\) gives the cyclic number 142857, and the case \(b = 12\), \(p = 5\) gives the cyclic number 2497. 
Not all values of \(p\) will yield a cyclic number using this formula; for example, the case \(b = 10\), \(p = 13\) gives 076923076923, and the case \(b = 12\), \(p = 19\) gives 076B45076B45076B45. These failed cases will always contain a repetition of digits (possibly several).
I won't go into the other number bases here and I haven't followed up on the link to Fermat primes. Here is a Numberphile YouTube video about cyclic numbers:


The video highlights how some of the formulae arise. For example:$$ \begin{align}\frac{1}{7} &=0.142857142857142857142857 ... \\
10^6 \times \frac{1}{7} &=142857.142857142857142857142857 ... \\
\frac{10^6}{7}-142857 &=0.142857142857142857142857 ...\\
\frac{10^6}{7}-142857 &=\frac{1}{7} \\
142857&=\frac{10^6-1}{7}\\
\end{align}$$Interestingly, there is even a reference to Gurdjieff in this video because the number 142857 features in his enneagram as shown in Figure 3.

Figure 3: 

As explained in Wikipedia:
The Fourth Way enneagram is a figure published in 1949 in In Search of the Miraculous by P.D. Ouspensky, and an integral part of the Fourth Way esoteric system associated with George Gurdjieff. The term "enneagram" derives from two Greek words, ennea (nine) and gramma (something written or drawn).
I won't further into that here as this blog focuses purely on Mathematics but I may follow up on it in my other blogs.

on February 27th 2021

Saturday, 16 November 2019

Eigenvalues and Eigenvectors


From left: Xining Zhang, Peter Denton and Stephen Parke
in front of the formula they discovered.

There was a very interesting story in Quanta Magazine recently titled Neutrinos Lead to Unexpected Discovery in Basic Math (November 13th 2019). The article begins:
After breakfast one morning in August, the mathematician Terence Tao opened an email from three physicists he didn’t know. The trio explained that they’d stumbled across a simple formula that, if true, established an unexpected relationship between some of the most basic and important objects in linear algebra. 
The formula “looked too good to be true,” said Tao, who is a professor at the University of California, Los Angeles, a Fields medalist, and one of the world’s leading mathematicians. “Something this short and simple — it should have been in textbooks already,” he said. “So my first thought was, no, this can’t be true.” 
Then he thought about it some more. 
The physicists — Stephen Parke of Fermi National Accelerator Laboratory, Xining Zhang of the University of Chicago and Peter Denton of Brookhaven National Laboratory — had arrived at the mathematical identity about two months earlier while grappling with the strange behavior of particles called neutrinos. 
They’d noticed that hard-to-compute terms called “eigenvectors,” describing, in this case, the ways that neutrinos propagate through matter, were equal to combinations of terms called “eigenvalues,” which are far easier to compute. Moreover, they realised that the relationship between eigenvectors and eigenvalues — ubiquitous objects in math, physics and engineering that have been studied since the 18th century — seemed to hold more generally. 
Although the physicists could hardly believe they’d discovered a new fact about such bedrock math, they couldn’t find the relationship in any books or papers. So they took a chance and contacted Tao, despite a note on his website warning against such entreaties. 
“To our surprise, he replied in under two hours saying he’d never seen this before,” Parke said. Tao’s reply also included three independent proofs of the identity.
There's a nice graphic in the article. This is shown in Figure 1. There is an accompanying commentary:
Figure 1
Eigenvectors and eigenvalues are ubiquitous because they characterise linear transformations: operations that stretch, squeeze, rotate or otherwise change all parts of an object in the same way. These transformations are represented by rectangular arrays of numbers called matrices. One matrix might rotate an object by 90 degrees; another might flip it upside down and shrink it in half. 
Matrices do this by changing an object’s “vectors” — mathematical arrows that point to each physical location in an object. A matrix’s eigenvectors — “own vectors” in German — are those vectors that stay aligned in the same direction when the matrix is applied. Take, for example, the matrix that rotates things by 90 degrees around the x-axis: The eigenvectors lie along the x-axis itself, since points falling along this line don’t rotate, even as everything rotates around them. 
A related matrix might rotate objects around the x-axis and also shrink them in half. How much a matrix stretches or squeezes its eigenvectors is given by the corresponding eigenvalue, in this case ½. If an eigenvector doesn’t change at all, the eigenvalue is 1. 
Eigenvectors and eigenvalues are independent, and normally they must be calculated separately starting from the rows and columns of the matrix itself. College students learn how to do this for simple matrices. But the new formula differs from existing methods. “What is remarkable about this identity is that at no point do you ever actually need to know any of the entries of the matrix to work out anything,” said Tao. 
The identity applies to “Hermitian” matrices, which transform eigenvectors by real amounts (as opposed to those that involve imaginary numbers), and which thus apply in real-world situations. The formula expresses each eigenvector of a Hermitian matrix in terms of the matrix’s eigenvalues and those of the “minor matrix,” a smaller matrix formed by deleting a row and column of the original one.
All this got me thinking about eigenvalues and eigenvectors again, and more generally linear algebra. I was reminded of 3BLUE1BROWN's excellent 15-part series of YouTube videos on linear algebra. Here is number 14 on eigenvectors and eigenvalues:


I've watched most of the videos before but it's probably time to watch the whole series again, just to refresh my understanding of the topic. I also need to spend some time familiarising myself with how SageMath implements the calculation of eigenvectors. Figure 2 shows a screenshot of a SageMathCell calculations of the eigenvectors and eigenvalues for the matrix shown in Figure 1.

Figure 2
In the SageMath code, I don't understand the difference between the eigenvectors_right() versus eigenvectors_left() commands. They give the same result in this case. The eigenvectors are also displayed in a rather odd and difficult to read format but it's all there so at least I know how to do that. 

What's clear is that, by using \((1, 1, 0) \), \((1, -1, 0) \) and \((0, 0, 1) \) as basis vectors for the 3 dimensional space, the linear transformation described in Figure 1 will only have a scalar effect of these vectors. Specifically, it will have cause them to be
  • unaltered along the \( (1, 1, 0) \) vector axis because eigenvalue is 1
  • flipped along the \( (1, -1, 0) \) vector axis because eigenvalue is -1
  • stretched by a factor of 2 along the \( 0, 0, 1) \) vector axis because eigenvalue is 2
In the old vector space with basis vectors [1, 0, 0], [0, 1, 0] and [0, 0, 1], the linear transformation in Figure 1 did have a scalar effect on the vector [0, 0, 1] by doubling it to [0, 0, 2] but the other two vectors ended up swapping places. Using the eigenvectors associated with the transformation as the basis vectors ensures that this sort of disruption is avoided.

After all of this, the details of the newly discovered identity have not been addressed really, apart from the photo showing the three discoverers in front of a blackboard where some of the details are discernible. Here is a link to Terence Tao's WordPress blog in which he discusses the new discovery. Figure 3 shows the newly developed theorem:

Figure 3: the new theorem as it appears on Terence Tao's blog

This is out of my league really but at least the article motivated me to revise some of the basics of linear algebra, so that's a good thing.

Read about Terence Tao's latest discovery regarding the Collatz Conjecture: 

https://t.co/h8cMC9QKes.

Thursday, 14 November 2019

More on the Mathematics of Chess

Figure 1: Book Cover
On Sunday, 6 January 2019, I published a post titled The Mathematics of Chess in which I discussed the number 25480 as the number of ways to place 2 non-attacking amazons (superqueens) on an 16 x 16 board. In that post, I made reference to Vaclav Kotesovec's magnum opus Non-attacking Chess Pieces that I have in my Calibre Library. Today I am reminded of its existence yet again because my diurnal age is 25792 and this turns out to be a member of OEIS A035288: the number of ways to place a non-attacking white and black bishop on n x n chessboard. 25792 arises when n=13.

This is a variation on the problem of how to place two non-attacking bishops on an n X n board. This problem is normally colour agnostic as shown in Figure 2.

Figure 2: two non-attacking bishops on an
8 x 8 board with both of the same colour

However, in the case of OEIS A035288, the two bishops are distinguishable because one is white and the other black as shown in Figure 3.

Figure 3: two non-attacking bishops on an 8 x 8 board
but with one white and the other black

OEIS A172123 deals with the number of ways to place 2 non-attacking bishops on an n x n board, where the bishops are not distinguishable from each other. The members of OEIS A035288 are simply twice the value of those in OEIS A172123. In Vaclav's book, it is these situations (where the pieces are indistinguishable) that are investigated. Figure 4 shows the table from page 241 of the book. The value of 12896 x 2 = 25792.

Figure 4: table of values for different numbers of
non-attacking bishops on varying sized boards

The author also provides generating functions for the different number of bishops and differently sized boards. I've just shown the first five in Figure 5 (taken from page 240 of the book).

Figure 5: generating function for two to five non-attacking bishops

In the case of two indistinguishable bishops, the generating function of interest is:$$-\frac{2x^2 \, (x+1) \, (x+2)}{(x-1)^5}$$This generating function can be used to generate the members of OEIS A172123. This is shown in Figure 6 for members of the sequence up to and including 12896:

Figure 6: SageMathCell code generating members of sequence A172123

The OEIS entry also lists a simple formula for determining the members of the sequence. It is:$$a(n) = \frac{n \,(n - 1) \, (3n^2 - n + 2)}{6}$$There is also a recursion formula:$$a(n) = 5 \,a(n-1)-10\, a(n-2)+10 \, a(n-3)-5 \,a(n-4)+a(n-5)$$It was good to be reminded of Vaclav's impressive book again but I also have in my possession another book titled Across the Board: The Mathematics of Chessboard Problems by John J. Watkins.
Figure 7: Book Cover

As the author says in this introduction:
... this book is about the game board itself, the simple grid of squares that forms such a common feature of games played around the world, and, more importantly, about the mathematics that arises from such an apparently simple structure.
The book contains much of interest that hopefully I'll be able to write about in later posts. Vaclav's book is really a reference source for a huge range of non-attacking pieces on various sized boards but Watkins looks a limited number of situations in detail. Figure 8 shows the very first problem that he deals with: Guarini's Problem that dates from 1520.
Figure 8: Guarini's Problem requires the white
and black knights to exchange positions

One solution involves reducing the board to a graph so that the situation is revealed more clearly. This is shown in Figure 9.

Figure 9: Guarini's Problem as a Graph

The graph clearly shows that four steps are involved, each step involving each of the four knights to advance to the next node (either clockwise or anticlockwise). If anticlockwise, then the knight on a will move to d, the knight on c will move to b, the knight on d will move to a and the knight on b will move to c.

Monday, 11 November 2019

Bell Numbers

Figure 1: book cover
I came across an interesting book titled Combinatorics and Number Theory of Counting Sequences by István Mezö and, while most of the content looks intimidating, the author starts off very simply. He certainly gets around as the brief biographical details in Figure 2 reveal. He has a website on Google Sites and interestingly he also has something to say about surreal numbers which I haven't heard anything of since reading Donald Knuth's eponymous book. Well, I started reading it but didn't finish. Maybe this guy can rekindle my interest.
Figure 2: brief biography of author
The first topic he introduces is Bell Numbers, that I've certainly heard about, but never understood. The problem with my current approach to number theory (whereby I look at the mathematical significance of my diurnal age) is that it's rather discursive. I come into contact with a broad range of concepts but don't pursue them in any great depth.

If I could work my way further into this book, I might be able to remedy that. Anyway, I now understand Bell Numbers and I'll try to present what I've found out about them here and hopefully include some practical applications that a little research may throw up. The Bell numbers arise from a simple enough problem. Suppose we have a group of six people that we shall label 1, 2, 3, 4, 5, 6. These six people can make up the set A = {1, 2, 3, 4, 5, 6}. We ask the question: in how many ways can we arrange these six people into groups with no person able to be in more than one group? A group can consist of between one and six members.

Figure 3: I downloaded and collected this group of six characters using SketchUp

The author starts off by looking at small sets. One person can be placed in only one group obviously but two people can be placed into groups in two different ways, either together 1, 2 or separately 1|2. For three people, there are five possibilities:

1, 2, 3 or 1|2, 3 or 2|1, 3 or 3|1, 2 or 1|2|3

These are the first three Bell numbers named after Eric Temple Bell (1883-1960), Scottish mathematician, writer and early science fiction author. Thus:$$B_1=1 \text{ and } B_2=2 \text{ and } B_3=5$$I'll quote directly from the book here and he explains how to derive a general recursive formula for the Bell numbers:
As n grows, it is becoming harder and harder to calculate the Bell numbers by simply listing the partitions, so we must find a simpler way. To do this, we consider the following method. Let us fix an n-set A, and we pick out an arbitrary element a from that of n. If we consider all the partitions of A, there will be n possible cases: the element a is in a block of k elements, where k can be 1, 2, . . . , n. The first possibility, when k = 1, results in the block {a}. When a is in a two-element block, say, in {a, b}, then we have to choose the element b beside a. This can be done in \(n − 1 =  \binom{n-1}{1} \) ways. If a is contained in a block of three elements, then we have to choose two elements beside a on \( \binom{n-2}{2} \) ways. And so on, until arriving k = n: if a is contained in an n-block (i.e., the partition contains one block and this is the whole A), then we have to choose n−1 elements beside a. This is possible just in \( \binom{n-1}{n-1}= 1 \) way. After n−1 fixing the size k of the block of a, we can focus on the remaining elements not in the block of a. We see that the remaining n−k elements can be partitioned arbitrarily and the total number of these partitions is \(B_{n−k} \) by the definition of the Bell numbers. Hence, for any single k there are \( \binom{n-1}{n-k} B_{n-k}\) cases. We can sum up the possible values of k, because these cases are pairwise disjoint. Hence we have:
$$B_n=1 \, . B_{n-1}+\binom{n-1}{1} \,.B_{n-2}+\binom{n-2}{2} \, . B_{n-3} + \dots + \binom{n-1}{n-1} \, . 1$$For consistency in the previous formula, we can replace the initial 1 with \( \binom{n-1}{0}\) and the final 1 with \(B_0=1\). This produces:$$B_n=\binom{n-1}{0} \, . B_{n-1}+\binom{n-1}{1} \,.B_{n-2}+\binom{n-2}{2} \, . B_{n-3} + \dots + \binom{n-1}{n-1} \, . B_0$$This can be written more succinctly as:$$B_n=\sum_{k=0}^{n-1} \binom{n-1}{k} \, .B_{n-k-1}$$Using the fact that \( \binom{n}{k}=\binom{n}{n-k} \) and \( \binom{n-1}{k}=\binom{n-1}{n-1-k} \), we can then write:$$B_n=\sum_{k=0}^{n-1} \binom{n-1}{n-1-k} \, .B_{n-1-k}=\sum_{k=0}^{n-1} \binom{n-1}{k} \, .B_{k}$$The recursive formula on the right enables us to find other Bell numbers. We already know that \(B_0=1, B_1=1, B_2=2 \text{ and } B_3=5 \) and so:$$B_4=\sum_{k=0}^{4-1} \binom{4-1}{k} \, .B_k=\binom{3}{0} \, . B_0+ \binom{3}{1} \, . B_1+\binom{3}{2} \, . B_2+\binom{3}{3} \, . B_3= 15$$Continuing this process, we get \(B_5=52\) and \(B_6=203\) and thus:

Question: in how many ways can we arrange these six people into groups with no person able to be in more than one group?

Answer: 203.

There is however, an easier way to generate the Bell numbers if we don't want to concern ourselves with theoretical justification. It involves use of the so-called Bell triangle, explained by Wikipedia in full but just shown below as it's pretty self-explanatory:
Here are the first five rows of the triangle constructed by these rules: 
 1
 1   2
 2   3   5
 5   7  10  15
15  20  27  37  52 
The Bell numbers appear on both the left and right sides of the triangle.
Mezö's approach to deriving the Bell numbers, as outlined above, involves the use of Stirling numbers of the second kind. These are simply the components of the summation that were obtained from the different values of k. The symbol used is:$$\begin{Bmatrix}
           n \\         
           k \\
          \end{Bmatrix}$$It represents how many groups of k can be formed from n elements. For example, take the case of n=4 and k=2. Suppose A = {a, b, c, d}, then we have the following seven possibilities:

1|2,3,4   2|1,3,4   3|1,2,4   4|1,2,3   1,2|3,4   1,3|2,4   1,4|2,3
$$\text{Thus }\begin{Bmatrix}
           4 \\         
           2 \\
          \end{Bmatrix}=7 \text{ and likewise }\begin{Bmatrix}
           4 \\         
           1 \\
          \end{Bmatrix}=1 \, , \begin{Bmatrix}
           4 \\         
           3 \\
          \end{Bmatrix}=6 \text{ and }\begin{Bmatrix}
           4 \\         
           4 \\
          \end{Bmatrix}=1$$ $$ \text{Thus we can say that } B_n=\begin{Bmatrix}
           n \\         
           1\\
          \end{Bmatrix}+\begin{Bmatrix}
           n \\         
           2 \\
          \end{Bmatrix}+ \cdots +\begin{Bmatrix}
           n \\         
           n \\
          \end{Bmatrix}$$That's as far as I'll pursue the Stirling numbers here but I'd like to now look at some of the practical applications for Bell numbers. Wikipedia provides two examples:
Factorisations
If a number N is a square-free positive integer (meaning that it is the product of some number n of distinct prime numbers), then Bn gives the number of different multiplicative partitions of N. These are factorisations of N into numbers greater than one, treating two factorisations as the same if they have the same factors in a different order. For instance, 30 is the product of the three primes 2, 3, and 5, and has B3 = 5 factorisations:$$30=2\times 15=3\times 10=5\times 6=2\times 3\times 5$$Rhyme schemes
The Bell numbers also count the rhyme schemes of an n-line poem or stanza. A rhyme scheme describes which lines rhyme with each other, and so may be interpreted as a partition of the set of lines into rhyming subsets. Rhyme schemes are usually written as a sequence of Roman letters, one per line, with rhyming lines given the same letter as each other, and with the first lines in each rhyming set labeled in alphabetical order. Thus, the 15 possible four-line rhyme schemes are AAAA, AAAB, AABA, AABB, AABC, ABAA, ABAB, ABAC, ABBA, ABBB, ABBC, ABCA, ABCB, ABCC, and ABCD.
Bell numbers can be prime and thus there are Bell primes. The first few are:$$B_2=2 \, ,B_3=5 \, , B_7=877 \text{ and }B_{13}=27644437$$The indices are prime as well but this is not always the case as the next two indices yielding prime numbers are 42 and 55 (and very large primes they are too). Bell is famous for his somewhat flawed 1937 book "Men of Mathematics" but he also wrote science fiction novels under the name John Taine.

Figure 4: cover of Bell's book

For some interesting biographical details on E. T. Bell, follow this link. There is an interesting comment made in A History of Mathematics: From Mesopotamia to Modernity by Luke Hodgkin (2005):
The fact that Wiles was stimulated in childhood by E. T. Bell's romantic personalized anecdotal book Men of Mathematics to nurse an ambition to solve the problem Fermat's Last Theorem is in itself an index of the power which a certain view of the history of mathematics can exercise.
On page 413 of Combinatorics and Number Theory of Counting Sequences, the author provides a table of the initial Bell numbers. This is shown in Figure 5:

Figure 5: the initial Bell numbers

Monday, 28 October 2019

Lagrange's Four-Square Theorem

Today's number of \(25775\), corresponding to my diurnal age, brought me into contact with Lagrange's Four-Square Theorem, also known as Bachet's Conjecture. To quote from Wikipedia, the theorem states that every natural number can be represented as the sum of four integer squares: $$p = a_0^2 + a_1^2 + a_2^2 + a_3^2$$where the four numbers \(a_0, a_1, a_2, a_3\) are integers. For illustration, 3, 31 and 310 can be represented as the sum of four squares as follows:$$\begin{align}
3 & = 1^2+1^2+1^2+0^2 \\[3pt]
31 & = 5^2+2^2+1^2+1^2 \\[3pt]
310 & = 17^2+4^2+2^2+1^2.
\end{align}$$ This theorem was proven by Joseph Louis Lagrange in 1770."

Historically, Wikipedia goes on to say that:
From examples given in the ''Arithmetica'' it is clear that Diophantus was aware of the theorem. This book was translated in 1621 into Latin by Claude Gaspard Bachet de Méziriac, who stated the theorem in the notes of his translation. But the theorem was not proved until 1770 by Lagrange. 
Adrien-Marie Legendre completed the theorem in 1797–8 with his Legendre's three-square theorem, by proving that a positive integer can be expressed as the sum of three squares if and only if it is not of the form \(4^k(8m+7)\) for integers \(k\) and \(m\). Later, in 1834, Carl Gustav Jakob Jacobi discovered a simple formula for the number of representations of an integer as the sum of four squares with his own Jacobi's four-square theorem. 
The formula is also linked to Descartes' theorem of four "kissing circles", which involves the sum of the squares of the curvatures of four circles. This is also linked to Apollonian gaskets, which were more recently related to the Ramanujan–Petersson conjecture.
Getting back to \(25775\), it turns out to be a member of OEIS A243580: integers of the form \(8k + 7\) that can be written as a sum of four distinct squares of the form \(m, m + 1, m + 3, m + 5\), where \(m == 2 \text{ (mod } 4) \). The particular value of \(m\) here is \(78\) so that we have:$$25775=78^2 + 79^2 + 81^2 + 83^2$$There are many proofs of the theorem and two are described in the Wikipedia article. They seem complicated and I haven't delved into them. However, what's of particular interest in the article is the number of ways in which a number can be represented as a sum of four squares, based on the sum (rather than the number) of divisors. There is a rule for the number of ways that a number can be written as a sum of two squares but this is based on powers of its prime divisors. The rule for the four squares is that the number is:
  • \(8\) times the sum of the divisors of the number if it is odd and 
  • \(24\) times the sum of the odd divisors of the number if it is even 
These numbers count squares in different positions and also include negative numbers. Thus the odd number \(1\), that has a sum of divisors equal to \(1\), has eight possible representations:
  • \(1^2+0^2+0^2+0^2\) with the 1 in four possible positions
  • \((-1)^2+0^2+0^2+0^2\) with the -1 in four possible positions
The number \(25775\) with a sum of \(31992\) would have a staggering \(8 \times 31992 = 255936\) possible representations as a sum of four squares. None of these representations would involve zero because \(25775\) cannot be expressed as a sum of two or three squares. It's easier to work initially with smaller numbers to begin with so let's take \(15 = 3 \times 5\) with a sum of divisors of \(24\). I've chosen \(15\) because it's equal to \(8 \times 1+7\) and thus cannot be represented as a sum of three squares. Thus \(15\) should have \(8 \times 24 = 192\) representations. This is indeed the case. However, if we don't regard different positions as being different, then there are only twelve arrangements. If we exclude negative numbers, there is only one arrangement: \(1^2+1^2+2^2+3^2\).

Moving on to \(23 = 8 \times 2+7\), there is again only one positive arrangement and that is \(1^2+2^2+3^2+3^2 \). With \(31 = 8 \times 3+7\), there are two positive arrangements: \(1^2+1^2+2^2+5^2\) and \(2^2+3^2+3^2+3^2\). Being primes, the sums of divisors of \(23\) and \(31\) are \(24\) and \(32\) respectively and so by Jacobi's theorem there are \(8 \times 24 =192\) and \(8 \times 32 = 256\) possible arrangements. It would seem that the theorem is of little practical use but interesting to explore nonetheless.

Saturday, 26 October 2019

The Smallest Parts Partition Function

Today I turned 25773 days old and I felt it shouldn't pass without making mention of this number's connection to the Smallest Parts Partition Function. This function assigns to each natural number \(n\), another number which is the total of the smallest parts in all partitions of \(n\). Here is the mapping, from \(n=1\) up to \(n=30\):

1, 3, 5, 10, 14, 26, 35, 57, 80, 119, 161, 238, 315, 440, 589, 801, 1048, 1407, 1820, 2399, 3087, 3998, 5092, 6545, 8263, 10486, 13165, 16562, 20630, 25773, ...

Figure 1 shows the SageMath code that I wrote to generate this sequence, up to and including 25773. Here is the Permalink.

Figure 1: SageMath code to generate
Smallest Parts Partition Numbers

Here is the example given in the OEIS A092269 comments:
Partitions of 4 are [1, 1, 1, 1], [1, 1, 2], [2, 2], [1, 3], [4]. 
1 appears four times in [1, 1, 1, 1]
1 appears two times in [1, 1, 2]
2 appears two times in [2, 2]
1 appears once in [1, 3]
4 appears once in [4]
Thus a(4)=4+2+2+1+1=10

Figure 2 shows a plot of the values up to 25773:

Figure 2: plot of the Smallest Parts Partition Function

Like the partition function, there is a generating function but it's rather complicated and I won't include it here. However, it can be viewed in the OEIS comments. I just wanted to mention it because the next member of the sequence is 31897 which is a long way off. There are a number of academic papers about this function so it is a topic of serious mathematical interest.

The number of partitions from 1 to 30 are shown in the list below:

[1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490, 627, 792, 1002, 1255, 1575, 1958, 2436, 3010, 3718, 4565, 5604]

It's interesting to look at the ratio between the total value of the number of smallest parts and the number of partitions for numbers between 1 and 30. The results and a plot of these values can be found in Figure 3.

Figure 3

Thursday, 10 October 2019

Totient and Sigma <--> Primes and Biprimes

Though it was obvious when I looked into it, I only recently realised that, for any prime number, the average of its totient and sum of divisors is equal to the number itself. This is because for a prime number \(p\), it's only divisors are itself and \(1\), thus the sum of divisors is \(p+1\). For the totient, the only number that is coprime with \(p\) is 1 and thus the totient is \(p-1\). Adding the sum of divisors and the totient together gives \(2p\) and the average is \(p\). Thus formally stated:


In a similar vein, it was only today that I discovered that for a number that is biprime, sometimes called semiprime, the average of its sum of divisors and totient is always one more than the number. Again, this was obvious once I looked into it. The reason is that a biprime number \(n\) has only two factors, let's say \(a\) and \(b\). Thus \(n=ab\). The sum of divisors is thus \(n+a+b+1\). For the totient, there are \(b-1\) multiples of \(a\) and \(a-1\) multiples of \(b\) that are coprime with \(n\). Thus the totient is \(n-a-b-1\), remembering that 1 is regarded as being coprime as well. Adding the sum of divisors and the totient together and averaging, we get:$$ \frac{(n+a+b+1)- (n-a-b-1)}{2}=\frac{2n+2}{2}=n+1$$This is all very simple stuff but I'd never seen this connection between the totients and sums of divisors of primes and biprimes formally stated before. Thus formally stated: