Sunday, 6 January 2019

The Mathematics of Chess

I've already posted about Chess960, also known as Fischer Random Chess (originally Fischerandom), explaining how the 960 possible starting positions for this variant of chess are obtained. There's a lot more mathematics of course on the chess board than that. Today I turned 25480 days old and the first entry in OEIS for this number is:
A172200: number of ways to place 2 non-attacking amazons (superqueens) on an n X n board. The sequence begins: 0, 0, 0, 20, 92, 260, 580, 1120, 1960, 3192, 4920, 7260, 10340, 14300, 19292, 25480, ... and for the case of 25480, the value of n is 16 so the placements are made on 16 X 16 board.
DIAGRAM 1: 16 X 16 board showing one of the 25480 possible
positions of two non-attacking amazons, represented by
the letter S standing for the German "Springer".

So what is an amazon or superqueen, I asked myself? The simple answer is provided in the comments to the OEIS sequence: an amazon (superqueen) moves like a queen and a knight. The comments also contain a link to a remarkable book that I've now downloaded and added to my Calibre Library.

DIAGRAM 2: cover of the book "Non-attacking chess pieces"

This monumental work is 795 pages in length and on page 347, the sole reference to 25480 can be found:
DIAGRAM 3: table showing the number of ways
in which 2, 3, 4 and 5 non-attacking amazons can be
placed on boards ranging in size from 1 X 1 to 20 X 20

The formula for obtaining this result is shown earlier on page 343:

DIAGRAM 4: page 343 of the text with annotations

One might argue that a so-called superqueen or amazon has no place in standard chess and you'd be right but, like it or not, there are a great many of these alternative pieces. The book mentioned earlier looks not only at the mathematics of standard pieces and boards but also these alternative pieces and even alternative boards. It's best to illustrate by example.

Let's consider another alternative piece, the nightrider, defined by Wikipedia as:
A fairy chess piece that can move any number of steps as a knight in the same direction. The nightrider is often represented by a symbol similar to the knight's icon, but altered in a way to indicate the additional straight-line motion. In this article the nightrider is represented with an inverted knight, and notation N (in which case the knight is abbreviated as S for German Springer). The nightrider was invented by T. R. Dawson in 1925, and is often used in chess problems.
See Figure 1. Note that intervening landing squares must be vacant. For example, a nightrider on b2 can reach empty square c4 and forward to empty squares d6 and e8, but cannot jump over a pawn on f4 to reach h5.:

Figure 1

Now let's consider a toroidal chessboard instead of the standard one:

DIAGRAM 6: toroidal chess board

In this type of board, the standard board is joined side to side to form a cylinder and then each end of the cylinder is joined, thus joining the top and bottom of the board. I won't go into the rules for moving on such a board but a detailed explanation of that can be found here. The reasonable question can then be asked: 
In how many ways can we place two non-attacking nightriders on a 16 X 16 toroidal chessboard?
Impressively, the previously mentioned book provides the answer: 25728 ways.

DIAGRAM 7: table showing no ways that two, three and four non-attacking
nightriders can be placed on boards ranging in size from 1 X 1 to 16 X 16

The formula for obtaining this is somewhat terrifying but I've included it below and must confess to having no idea of how it was arrived at:

DIAGRAM 8: screenshot from page 333 of
the book "Non-attacking chess pieces"

This sequence of terms 2, 18, 72, 200, ... in the column above comprises A196812 in the OEIS. In summary, the different possible positions of standard and fairy chess pieces on standard and non-standard boards provide fertile grounds for mathematical analysis. This post just hints at the range and complexity of content that can be found in Vaclav Kotesovec's remarkable book.

Tuesday, 1 January 2019

Sphenic Numbers Revisited

After this post, I discovered that I'd already made an earlier post about sphenic numbers. No matter but it alerted me to the fact that I've made so many posts to this mathematics blog that I'm losing track of what I've posted.

Today I turned 25474 days old. This number factors to 2 * 47 * 271. Yesterday's number, 25473, factors to 3 * 7 * 1213. Both are sphenic numbers, described by Numbers Aplenty as follows:
A number \(n\) is called sphenic if it is the product of 3 distinct primes. For example, 370 is a sphenic number because it is the product of the 3 primes 2, 5 and 37. Sphenic numbers are quite common: up to \(10^8\) there are 20710806 sphenic numbers (that's about 20%). 
The sum of the reciprocals of the sphenic numbers diverges, while the sum of the reciprocal of their squares converges to \(0.003696244...\), which can be expressed as: $$ \frac{(P(2)^3-3 \, P(2) \, P(4)+2 \,P(6))}{6}\\ \text { where }P(s)=\sum_{p\mathrm{\ prime}}\frac{1}{p^s}$$ is the so-called prime Zeta function. 
The first sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310
Wikipedia adds that:
All sphenic numbers have exactly eight divisors. If we express the sphenic number as \( n = p \cdot q \cdot r\) where \(p\), \(q\), and \(r\) are distinct primes, then the set of divisors of \(n\) will be \({1, p, q, r, pq, pr, qr, n}\). The converse does not hold. For example, 24 is not a sphenic number, but it has exactly eight divisors. 
All sphenic numbers are by definition squarefree, because the prime factors must be distinct. 
The first case of two consecutive sphenic integers is 230 = 2×5×23 and 231 = 3×7×11. The first case of three is 1309 = 7×11×17, 1310 = 2×5×131, and 1311 = 3×19×23. There is no case of more than three, because every fourth consecutive positive integer is divisible by 4 = 2×2 and therefore not squarefree. 
The numbers 2013 (3×11×61), 2014 (2×19×53), and 2015 (5×13×31) are all sphenic. It's interesting that these very recent calendar years formed a sphenic triplet, although I didn't know it at the time I was living through them. The next three consecutive sphenic years will be 2665 (5×13×41), 2666 (2×31×43) and 2667 (3×7×127) (see OEIS A248202 for a list of the central number of such triples). 
Sphenic Brick
In terms of geometry, each sphenic number can be considered to represent the volume of a unique and "primitive" rectangular prism (sometimes called a sphenic brick) whose dimensions are given by its three prime factors. I'm using primitive here in the same sense as "primitive Pythagorean triad" such as 3, 4 and 5 (as opposed to 6, 8 and 10). By its definition however, a sphenic number can never represent the volume of a cube or a rectangular prism with a square cross-section.

Each sphenic number \( n = p \cdot q \cdot r\) can be associated with another number, namely the surface area of the rectangular prism  \( 2 \, (p \cdot q + p \cdot r+q \cdot r) \). For example, the sphenic number  \( 7429 = 17 \cdot 19 \cdot 23\) can be viewed as a rectangular prism with an associated surface area of \(2302\) square units. The ratio between area and volume can then be explored. The table below shows the values of such ratios for sphenic numbers between 25400 and 25500:


It is possible for the volume and surface area to be equal. In a range of numbers between 1 and 1000, the only such dimensions that produce this are:
  • 3 x 7 x 42   --> 882 
  • 3 x 8 x 24   --> 576
  • 3 x 9 x 18   --> 486
  • 3 x 10 x 15 --> 450
  • 4 x 5 x 20   --> 400
  • 4 x 6 x 12   --> 288
Whether these are the only values with this property I don't know but none of the above numbers (288, 400, 450, 486, 576 and 882) are sphenic so it's likely that there are no sphenic numbers with this property.

To determine the sphenic numbers within a given range, this SageMath code (link to SageMathCell server) can be used or the box below (sometimes temperamental) can be experimented with:


Thursday, 20 December 2018

A Prime to Remember

Primes come and go but lately, as I keep a daily track of the number of my diurnal days, there has been more than usual. To illustrate, days 25447, 25453, 25457, 25463, 25469, and 25471 are all primes in a 6-4-6-6-2 pattern. After 25471 there will quite a drought because the next prime is 25523, a gap of 32.

Today I'm 25463 days old and I can't let it pass without recording some of its more interesting properties. One of these is that it is a member of OEIS A165572: the greater prime factor of successively better Golden Semiprimes. These semiprimes p*q, starting from 6=2*3, have the property that each successive value of q/p gives a better approximation of the Golden Ratio than the previous term where the $$ \text{Golden Ratio } \phi=\frac{1+\sqrt(5)}{2} \approx \, 1.61803398874989$$Here are the initial members of this sequence: 3, 5, 11, 31, 37, 47, 157, 571, 911, 1021, 1487, 2351, 3571, 24709, 25463. The corresponding semiprimes form OEIS A165570 and consist of 6, 15, 77, 589, 851, 1363, 15229, 201563, 512893, 644251, 1366553, 3416003, 7881197, 377331139, 400711231, 2963563859, 4035221017.

Here are the progressively better approximations as the larger factor of the semiprime is divided by the smaller:

3/2         1.50000000000000
        5/3         1.66666666666667
        11/7         1.57142857142857
    31/19         1.63157894736842
      37/23         1.60869565217391
     47/29         1.62068965517241
157/97         1.61855670103093
  571/353         1.61756373937677
    911/563         1.61811722912966
1021/631         1.61806656101426
1487/919         1.61806311207835
 2351/1453         1.61803165863730
  3571/2207         1.61803352967830
 24709/15271         1.61803418243730
25463/15737         1.61803393276991

Another property of 25463, albeit a base dependent one, is its membership in OEIS A156119: primes formed by rearranging five consecutive decimal digits (avoiding leading 0). No primes can be formed from {1,2,3,4,5} or {4,5,6,7,8} since they are divisible by three. Sequence is finite, ending with a(52)=96857. Initial members of sequence are: 10243, 12043, 20143, 20341, 20431, 23041, 24103, 25463.

Yet another property, again base dependent, is its membership of OEIS A124629: primes p such that their cubes are pandigital, meaning all digits from 0 to 9 must appear at least once; here 25463^3=16509301927847. The initial members of this sequence are: 5437, 6221, 7219, 8443, 10903, 11353, 15937, 17123, 18229, 19429, 20353, 20903, 20929, 21803, 21841, 21961, 22123, 22283, 22993, 23053, 23369, 23663, 24733, 25183, 25219, 25463.

Not base dependent is the property that 25463 shares as a member of OEIS A226154: smallest of four consecutive primes whose sum is a triangular number. Triangular numbers are of the form:$$ \binom{n}{2}= \frac{n \, (n-1)}{2}$$The initial members of this sequence are: 5, 23, 191, 389, 449, 2593, 3011, 5167, 5639, 5851, 8669, 18839, 25463. Here the four primes add to 101926 = 25463+25469+25471+25523 and this sum is a triangular number because: $$101926 = \binom{452}{2}=\frac{452 \times 451}{2}$$ 

Finally and again base independently, 25463 is a member of OEIS A022121: Fibonacci sequence beginning 3, 8. The initial members of this sequence are: 3, 8, 11, 19, 30, 49, 79, 128, 207, 335, 542, 877, 1419, 2296, 3715, 6011, 9726, 15737, 25463.

Random Walks

Let's consider the following situation. We start at the origin (0,0) and want to get to the point (4,4). However, we can only move one step at a time, either horizontally or vertically. We are constrained to move within the grid of points shown. Given this constraint, horizontal movement can be to the left or right and vertical movement can be up or down. However, we have no control over this step by step movement. It is completely random. On average, how many steps should be required to reach our destination?

FIGURE 1

I set up a program in SageMathCell to simulate this random walk over 1,000 trials. The result returned a median walk of 60 steps. What happens as the grid grows larger? I was interested in looking at the relationship between the size of the grid and the average number of steps required to reach the goal. Here are the results for grids with of size 1 to 21 and a graphical representation in FIGURE 2:

1234567891011
2143460108156224289388534587


12131415161718192021
76288411041270142016571785211424422693


FIGURE 2

Not surprisingly the graph seems to be that of a parabola and my best fit formula, based on the above data, gives its equation as \(y=5.2 \, x^2\). 

This type of walk can be extended to 3 dimensions so that from (0, 0, 0) we need to get to (2, 2, 2) for example:

FIGURE 3

Running a thousand trials again on SageMathCell again, we get a median of 40 steps with a minimum of 6 (the least possible) and a maximum of 344. What's surprising is the vastly different lengths of these random walks. For example, with a cube of side 10, a median of 3075 steps is returned from the thousand trials but the maximum is 46826 and the minimum is 114. Here are the results (the simulation was too slow for sides greater than 10):

12345678910
7401172544737931129178623903075

FIGURE 4

Although it looks parabolic, it's probably cubic and, if this is the case, then an equation of \(y=0.27 \, x^3 \) seems the best fit. In any case, this post is not meant to be definitive. It's just meant to clarify my thinking. I'll need to pursue this further and improve on the accuracy of these possible equations.

Saturday, 15 December 2018

Primitive Abundant Numbers

Preliminary note: I've written about odd primitive abundant numbers in an earlier, eponymous post from May 21st 2017, so some content from that post is repeated here but there is new content as well. Here is the link.

**************************

The sum of the proper divisors of an abundant number is greater than the number itself. The integer 12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6 for a total of 16. So what is a primitive abundant number?

To quote from Numbers Aplenty:
An abundant number is called primitive if none of its proper divisors is abundant. 
There are infinitely many such numbers, both even and odd. However Dickson proved that there are only a finite number of odd primitive abundant numbers with a given number of distinct prime factors. 
For example, there are only 8 odd primitive abundant numbers with 3 distinct prime factors, namely, 945, 1575, 2205, 7425, 78975, 131625, 342225, and 570375. 
The first primitive abundant numbers are 12, 18, 20, 30, 42, 56, 66, 70, 78, 88, 102, 104, 114, 138, 174, 186, 196 more terms. 
A second definition of primitive numbers excludes also those that have perfect proper divisors, like all multiples of 6. The first such numbers are 20, 70, 88, 104, 272, 304, 368, 464, 550, 572, 650, 748, 836, 945, 1184, 1312, 1376, 1430, 1504, 1575, 1696, 1870, 1888, 1952, 2002.
Here are some properties of primitive abundant numbers taken from Wikipedia:
Every multiple of a primitive abundant number is an abundant number. 
Every abundant number is a multiple of a primitive abundant number or a multiple of a perfect number. 
Every primitive abundant number is either a primitive semiperfect (also called primitive pseudoperfect) number or a weird number. 
There are an infinite number of primitive abundant numbers. 
The number of primitive abundant numbers less than or equal to \(n\) is \( o \left( \frac{n}{\log^2(n)} \right)\ \). 

A semiperfect or pseudoperfect number is a natural number that is equal to the sum of all or some of its proper divisors. A primitive semiperfect number (also called a primitive pseudoperfect number, irreducible semiperfect number or irreducible pseudoperfect number) is a semiperfect number that has no semiperfect proper divisor. The first few primitive semiperfect numbers are 6, 20, 28, 88, 104, 272, 304, 350, ... There are infinitely many odd primitive semiperfect numbers, the smallest being 945.

A weird number is a natural number that is abundant but not semiperfect or pseudoperfect. In other words, the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of those divisors sums to the number itself. The first few weird numbers are 70, 836, 4030, 5830, 7192, 7912, 9272, 10430, 10570, 10792, 10990, 11410, 11690, 12110, 12530, 12670, 13370, 13510, 13790, 13930, 14770, ...

See my blog post titled Zumkellar, Half-Zumkellar, and Pseudoperfect Numbers and Odd Primitive Abundant Numbers.

Tuesday, 4 December 2018

Admirable Numbers and Compatible Numbers

Yesterday I turned 25446 days and this number was identified by Numbers Aplenty as an admirable number, defined as a number \(n\) for which there exists a divisor \(d\) of \(n\) such that \(2n = \sigma(n)-2d\). In other words, \(n\) is equal to the sum of its proper divisors, where one of them has a minus sign.

For 25446, the divisors are: 1, 2, 3, 6, 4241, 8482, 12723, 25446 and the sum of these divisors is 50904. However, 50904 - 2 x 6 = 50892 = 2 x 25446 and here the divisor 6 has been assigned the minus sign. The modified divisors (1, 2, 3, -6, 4241, 8482, 12723) now add to 25446. The previously mentioned website goes on to say that:
Clearly, admirable numbers are a subset of abundant numbers and they are infinite because, for example, all the numbers 6\(p\), with \(p\)>3 prime, are admirable. The largest number that cannot be written as a sum of admirable numbers is 1003. Pairs of consecutive admirable numbers are rarer than pairs of consecutive abundant numbers. Up to \(10^{12}\), there are only two such pairs, namely 29691198404, 29691198405 and 478012798575, 478012798576.
On the other hand, pairs of admirable numbers that differ by two are more common but still sparse. There are 72 such pairs up to 27000.
 

The smallest 3 x 3 magic square made up of admirable numbers is shown in Figure 1.

Figure 1: smallest possible magic square
made from admirable numbers

OEIS A111592 lists the initial admirable numbers:
12, 20, 24, 30, 40, 42, 54, 56, 66, 70, 78, 84, 88, 102, 104, 114, 120, 138, 140, 174, 186, 222, 224, 234, 246, 258, 270, 282, 308, 318, 354, 364, 366, 368, 402, 426, 438, 464, 474, 476, 498, 532, 534, 582, 606, 618, 642, 644, 650, 654, 672, 678, 762, 786, 812, ...
These numbers are related to Zumkellar, Half-Zumkellar and pseudoperfect numbers in that they all involve the divisors of the number. See my blog post on these sorts of numbers.

In the OEIS comments, we read that "the concept of admirable numbers was developed by educator Jerome Michael Sachs (1914-2012) for a television in-service training course in mathematics for elementary school teachers." Here is the link to the article that he wrote in The Arithmetic Teacher, Vol. 7, No. 6 (1960), pp. 293-295. However, in that article he allows more than one of the divisors of a number to be negative. For example, he writes 24 as being equal to the following algebraic sum of its divisors: 4+6+8+12-1-2-3. However, this is the same as 1+2+3+4+8+12-6 so it's not clear whether a sum involving multiple negative divisors is always equivalent to another sum involving a single negative divisor.

Sachs also introduces the notion of a compatible number pair as an extension or relaxation of the concept of an amicable number pair. For example, 220 and 284 are an amicable pair because the proper divisors of each add to the other number. The proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110 and these add to 284. The proper divisors of 284 are 1, 2, 4, 71 and 142 and these add to 220. In such cases, the smaller number is abundant and the larger number deficient.

Sach's proposal for a compatible number pair is two numbers such that the algebraic sums of their divisors each leads to the other number. For example:
  • 30 has divisors of 1, 2, 3, 5, 6, 10, 15
  • 40 has divisors of 1, 2, 4, 5, 8, 10 and 20
  • 40 = 2 + 3 + 5 + 6 + 10 + 15 - 1
  • 30 = 1 + 2 + 4 + 5 + 8 + 20 - 10
So he defines 30 and 40 as compatible numbers.

The smaller members of such pairs are listed in OEIS A109797 while the larger members are listed in OEIS A109798.

Here is the SageMath code to generate the admirable numbers between 25000 and 26000

Friday, 30 November 2018

The Apocryphal Diderot-Euler Encounter

There is an interesting story about an encounter between Diderot and Euler in the palace of Catherine the Great in St.Peterburg. I've come across two versions of the story, one in Bell's "Men of Mathematics" and the other in Hogben's "Mathematics for the Million". Both are essentially the same and there are many other slightly differing versions about. Here is the account by Hogben:

Figure 1
This is nonsense because Diderot was an accomplished mathematician in his own right. He apparently didn't know how to respond and, embarrassed, made a quick exit. The next day he asked the Empress for safe passage back to Paris. Even though the story is apocryphal, the mathematical equation interested me (from a mathematical perspective not a theological one), so I thought I'd investigate it a little. Firstly though I imposed some restriction on a, b and n: they must be integers and all greater than zero. $$  \frac{a+b^n}{n}=x \text{   with }a, b, c >0 \text { and } a, b, c \, \in \, \, Z $$Let's consider the case where \(x=100\) and \( n=1\). We have simply:$$ a+b=100 \text{ and }b=100-a$$Thus \(a=1\) and \(b=99 \), \(a=2 \) and \(b=98 \), ..., \(a=99\) and \(b=1\) are the possible solutions.

Let's next consider the case where \(x=100\) but \(n=2\). In this case we get:$$ \frac{a+b^2}{2}=100 \text{ and }b=\sqrt{200-a}$$For this result, the values of a must be chosen so that \(\sqrt{200-a} \) is a square number. The square numbers between 0 and 200 are 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196 and correspond to \(b\) values of 1, 2, ..., 13, 14 with associated \(a\) values of 199, 196, ..., 31, 4.

In the case where \(x=100\) and \(n=3\) we get: $$ \frac{a+b^3}{3}=100 \text{ and }b=\sqrt[3]{300-a}$$Here, the values of a must be chosen so that we can find an integral cube root of the number under the cube root sign. The cubes that lie between 0 and 300 are 1, 8, 27, 64, 125 and 216 and so \(a\) values of 299, 292, 273, 236, 175 and 84 correspond to \(b\) values of 1, 2, 3, 4, 5 and 6.

As n increases, the possible values of \(a \) decrease:
  • fourth power (\(n=4\)) numbers less than 400 are 1, 16, 81 and 256
  • fifth power numbers (\(n=5\)) less than 500 are 1, 32 and 243
  • sixth power numbers (\(n=6\)) less than 600 are 1 and 64
  • seventh power numbers (\(n=7\)) less than 700 are 1 and 128
  • eighth power numbers (\(n=8\)) less than 800 are 1 and 256
  • ninth power numbers (\(n=9\)) less than 900 are 1 and 512
  • tenth power numbers (\(n=10\)) less than 1000 are 1 only
As can be seen, the multiples of 100 are soon overtaken. So just to check, let's take the case where n=9 and we want \(900-a=512\) and so \(a=388\) and \(b=2\). This means 100 can be written as:$$100=\frac{388+2^9}{9}$$From this analysis, it's clear that for any given integer \(x\) there are numerous ways to represent it in the form examined but their number is definitely finite.