Saturday, 21 December 2019

The Original Taxi Cab Number in a New Light

Today I turned 25829 days old and, amongst the number's many different properties, one in particular caught my eye. The property was that it is a member of OEIS A262054: Euler pseudoprimes to base 7: composite integers such that:$$ |7^{(n-1)/2}| \equiv 1 \pmod {n}$$Now there's no sign of 1729, the original taxi cab number, but we'll get there. Firstly however, how did 1729 earn its sobriquet? Here an excerpt from Wikipedia:
The name is derived from a conversation in about 1919 involving mathematicians G. H. Hardy and Srinivasa Ramanujan. As told by Hardy: 
"I remember once going to see him [Ramanujan] when he was lying ill at Putney. I had ridden in taxi-cab No. 1729, and remarked that the number seemed to be rather a dull one, and that I hoped it was not an unfavourable omen. "No," he replied, "it is a very interesting number; it is the smallest number expressible as the sum of two [positive] cubes in two different ways."
Figure 1

The two different ways are: \(1^3 + 12^3\) and \(9^3 + 10^3\).

I won't go further into taxicab numbers here as the Wikipedia article explains things well enough. What I want to do is cast a new light on 1729, the number that Hardy originally thought was a rather dull number. The light I'm casting comes from the Euler pseudoprimes. 

I've already discussed pseudoprimes in two earlier posts: Fermat Pseudoprimes and Carmichael Numbers. I did make make passing mention of Euler pseudoprimes in the former post but didn't go into the matter further. Figure 1 shows a screenshot of part of what Wikipedia has to say about Euler pseudoprimes. 

The excerpt in Figure 1 concludes with the observation that:
The absolute Euler pseudoprimes are a subset of the absolute Fermat pseudoprimes, or Carmichael numbers, and the smallest absolute Euler pseudoprime is 1729 = 7×13×19.
It's surprising then that a mathematician of Hardy's calibre should not have recognised 1729 as having quite some claim to fame. In fact, the Online Encyclopaedia of Integer Sequences (OEIS) has 794 entries for the number so it is far from dull. Let's consider some of the other entries for 1729 in the OEIS. 

One entry is not surprising when the factorisation of 1729 is considered and the factors are arranged in descending order: 19 x 13 x 7. Let's add a 1 to give 19 x 13 x 7 x 1. The numbers 19, 13, 7 and 1 form an arithmetic sequence and this shows 1729 to be a so-called sextuple factorial. This can be written as 19!!!!!! or 19!6.

1729 counts the ways that a 2 x 2 matrix can be populated with integers from -7 to +7 in such a way that every matrix is singular (that is has a determinant of zero). It thus forms part of OEIS A209981

Figure 2: 35 points in a body-centered cubic lattice, 
forming two cubical layers around a central point

In the realm of figurate numbers, 1729 is a centred cube number. These are numbers of the form:\((n+1)^3+n^3\) and of course 1729 can be written as \(10^3+9^3\). Figure 2 shows the example of the centred cube number 35 and Wikipedia explains:
A centred cube number is a centred figurate number that counts the number of points in a three-dimensional pattern formed by a point surrounded by concentric cubical layers of points, with \(i^2\) points on the square faces of the \(i\)-th layer. Equivalently, it is the number of points in a body-centred cubic pattern within a cube that has \(n + 1\) points along each of its edges. 
The first few centred cube numbers are:
1, 9, 35, 91, 189, 341, 559, 855, 1241, 1729, 2331, 3059, 3925, 4941, 6119, 7471, 9009, ... (sequence A005898 in the OEIS).
1729 is also an heptagonal number, a 12-gonal or dodecagonal number, a 24-gonal or icosotetragonal number but that's probably enough for the moment.

Tuesday, 10 December 2019

Mathematics in Everyday Life

How many times have I opened a box of tissues by removing the elliptical cover on the top of the box? Every time I do it, I'm aware of its elliptical shape but I never paused to consider the resulting ellipse of cardboard that I held in my hand. It would be discarded as rubbish. Today however, I paused and really looked at what I had in my hand (see Figure 1).

Figure 1

There's even a little semi-circular tab on the right that can be depressed to facilitate the removal of the cover. I'd never noticed that before. Turning the cardboard ellipse over reveals blank cardboard on which I marked in the major and minor axes and measured their lengths, to the nearest millimetre (see Figure 2).

Figure 2

These measurements enable calculation of the eccentricity \(e\) of the ellipse and so in this case, with \(a=28\) and \(b=62.5\) where \(a\) and \(b\) are the lengths of the semi-minor and semi-major axes respectively, we have:$$e=\sqrt {1-\frac{a^2}{b^2}}=\sqrt {1-\frac{28^2}{62.5^2}} \approx 0.894$$This of course is highly elliptical, especially if it's compared with the eccentricities of the planets of the solar system (see Figure 3).



Figure 3

As can be seen in Figure 3, Mercury and Pluto have the most eccentric orbits but much less eccentric than my cardboard ellipse. The other planets have elliptical orbits that would be hard to distinguish from circles if their proportions were displayed on a cardboard cut-out similar to that shown in Figure 2. Coincidentally, there is a centaur with an eccentricity of 0.894 as the table shown in Figure 4 reveals. The academic paper that the table was taken from is quite an interesting but I won't go into here but this is the link, the same as the one shown in Figure 4.


Figure 4

As explained in Figure 4, centaurs are planetesimals with perihelia (closest distance to the Sun) exterior to the orbit of Jupiter and aphelia (farthest distance from the Sun) interior to the orbit of Neptune. The most famous of the centaurs in Chiron, the first to be discovered in 1977 but the somewhat less famous C/2012 H2 (McNaught) does have an orbit that exactly matches that of the cardboard ellipse shown in Figures 1 and 2. Figure 5 provides a little more information about this object.

Figure 5

To calculate the length \(F\) from the centre of the ellipse to the two foci, the following formula can be used involving once again the lengths of the semi-minor and semi-major axes:$$F=\sqrt{b^2-a^2}=\sqrt{62.5^2-28^2} \approx 55.9$$These foci for the cardboard ellipse are shown in Figure 6.


Figure 6

The mathematics in this post is very basic but that was my intention. Though basic, the shape of the cardboard ellipse is nonetheless reflected in the shape of a particular centaur's orbit and it's pretty cool to find a connection between an everyday household item and the solar system in which we are immersed.

Monday, 25 November 2019

The Goldbach Conjecture and Lucky Numbers

I've written before about Lucky Numbers (Generating Lucky Numbers in Python and Lucky Numbers) as well as the Goldbach Conjecture (Goldbach's Conjecture and Zeckendorf's Theorem and Goldbach's Conjecture Revisited) but now it's time to combine the two topics. The reason we can do this is that primes and lucky numbers have similar distributions. The table in Figure 1 attests to this:
Figure 1: source URL

As stated on the site from which the table was taken:
What's most interesting about lucky numbers is the fact that they share a lot of properties with primes. As can be seen from the next table the density of the lucky numbers is close to the density of the primes. This seems also be true for the density of the twin luckies and the twin primes. In addition a lot of conjectures about primes seem also to be true for the luckies. For example one of the most famous ones, the Goldbach conjecture, stating that each even integer is the sum of at most two primes seems also to be true.
Goldbach decompositions are numerous and so, as with the decomposition into primes, we are interested in the minimal decomposition but first let's state the Goldbach conjecture for lucky numbers:

Every even number can be expressed as a sum of two lucky numbers

The smallest even number is 2 and that can expressed as 1 + 1. This is a little different to the primes where 1 is not regarded as a prime. Thus the Goldbach Conjecture for primes requires the even number to be greater than 2. The next even number is 4 and that can be expressed as 1 + 3 and so on. Let's take a number like 25800 and find it's minimal decomposition using SageMath. Figure 2 depicts the results using a screenshot from SageMathCell (permalink).

Figure 2: permalink

An interesting observation made on the website is that "no lucky number can have a digital root of 2, 5 and 8. This fact can sometimes be used to determine quickly that a given number is not lucky." I was able to find an explanation of why this is so thanks to a reference in Gardner's Workout by Martin Gardner. This is shown in Figure 3.

Figure 3

To see this, consider \(\frac{3k+2}{9}\). If \(k=1\) then the remainder is 5, if \(k=2\) then the remainder is 8, if \(k=3\) then the remainder is 2 and so on. The only remainders that can occur are 2, 5 and 8.

1 2 3 4 5 6 7 8 9
1 x 3 x 5 x 7 x 9 : first step of sieving process, all multiples of 2 are removed
1 x 3 x x x 7 x x : second step of sieving process, all multiples of 5 are removed

It is this sieving process, similar to the Sieve of Eratosthenes that causes the lucky numbers to have properties similar to the primes.

There are lots more "extensions" to the original Goldbach conjecture. One such one is the ternary Golbach conjecture described in the following abstract of a 79 page paper presented in 2014:
THE TERNARY GOLDBACH CONJECTURE IS TRUE
H. A. HELFGOTT 
Abstract. The ternary Goldbach conjecture, or three-primes problem, asserts that every odd integer n greater than 5 is the sum of three primes. The present paper proves this conjecture. 
Both the ternary Goldbach conjecture and the binary, or strong, Goldbach conjecture had their origin in an exchange of letters between Euler and Goldbach in 1742. We will follow an approach based on the circle method, the large sieve and exponential sums. Some ideas coming from Hardy, Littlewood and Vinogradov are reinterpreted from a modern perspective. While all work here has to be explicit, the focus is on qualitative gains. 
The improved estimates on exponential sums are proven in the author’s papers on major and minor arcs for Goldbach’s problem. One of the highlights of the present paper is an optimized large sieve for primes. Its ideas get reapplied to the circle method to give an improved estimate for the minor-arc integral.
A certain Zoltan Galantai has also investigated generalisations to the Goldbach conjecture at this site

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:
A006883A097443A055628A056157A056210A056211A056212A056213A056214A056215A056216A056217A098680, 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
  2
 2   3   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.