Monday 29 April 2019

Ruth-Aaron Pairs and eRAPs

Today I turned 25593 days old and on Numbers Aplenty I read the following:
With its predecessor 25592, 25593 forms an eRAP, since the sums of their prime factors are consecutive (470 and 471).
There was a link to eRAP that began:
Abhiram R. Devesh proposed an extension of Ruth-Aaron Pairs (thus called eRAP) where two consecutive numbers form a pair if the sums of their prime factors are consecutive. 
So before delving into eRAPs, I'll discuss the RAPs or Ruth-Aaron Pairs. Here is what Numbers Aplenty had to say about these pairs of numbers:
Two consecutive number \(n \) and \(n+1\) form a Ruth-Aaron pair if they share the same sum of prime factors. The name is commonly used for the two different families obtained taking into account or not the primes multiplicities. For example, if only distinct primes are counted, then \((104, 105) \) is a pair, since \(104=2^3\cdot13 \) and  \(105=3\cdot5\cdot7\) and \(2+13=3+5+7\). 
The first pairs of this kind are (5, 6), (24, 25), (49, 50), (77, 78), (104, 105), (153, 154), (369, 370), (492, 493), (714, 715), (1682, 1683). If instead repeated primes are counted, \((125=5^3, 126=2\cdot 3^2\cdot7) \) is a pair since \(5\cdot3 = 2+3\cdot2+7\). The first pairs of this kind are (5, 6), (8, 9), (15, 16), (77, 78), (125, 126), (714, 715), (948, 949), (1330, 1331), (1520, 1521), (1862, 1863). 
Clearly if both members of a pair are square-free, then they belong to both sets. It is conjectured that there are infinite Ruth-Aaron pairs (since this descends from Schinzel's Hypothesis H), however Carl Pomerance has proved that the sum of the reciprocals of Ruth-Aaron numbers is bounded. 
A few Ruth-Aaron triples are known (I searched them up to 1013). The first one, counting distinct primes, is formed by: 

  • 89460294 = 2 × 3 × 7 × 11 × 23 × 8419 
  • 89460295 = 5 × 4201 × 4259 
  • 89460296 = 23 × 31 × 43 × 8389. 

Other such triples start at: 

  • 151165960539 
  • 3089285427491 
  • 6999761340223 
  • 7539504384825

Counting all the prime factors, the first triple is given by: 

  • 417162 = 2 × 3 × 251 × 277 
  • 417163 = 17 × 53 × 463 
  • 417164 = 22 × 11 × 19 × 499

Another such triple start at 6913943284. 
The first numbers which belong to a Ruth-Aaron pair are 5, 6, 8, 9, 15, 16, 24, 25, 49, 50, 77, 78, 104, 105, 125, 126, 153, 154, 369, 370, 492, 493, 714, 715, 948, 949, 1330, 1331, 1520, 1521, 1682, 1683, 1862, 1863
This leads us on to eRAPs or extended Ruth_Aaron Pairs defined as consecutive numbers whose respective sums of prime divisors are also consecutive. It seems that repeated prime divisors are included. Here is a list of such pairs up to 25600:

Figure 1: eRAPs between 1 and 25600

Numbers Aplenty goes on to give the following information about eRAPs:
Up to \(10^{13}\)  there are only 5 eRat triples, namely (2, 3, 4), (3, 4, 5), (27574665988, 27574665989, 27574665990), (1862179264458, 1862179264459, 1862179264460), and (9600314395008, 9600314395009, 9600314395010). 
For the smallest nontrivial triple we have: 
\(27574665988 =2^2 \cdot 139 \cdot 269 ⋅\cdot 331 \cdot 557 \)
\(27574665989 =13 \cdot 41 \cdot 191 \cdot 439 \cdot 617 \)
\(27574665990 =2 \cdot 3 \cdot 5 \cdot 19 \cdot 163 \cdot 449 \cdot 661\) 
and the sums of prime factors (with multiplicities) are 1300, 1301, and 1302, respectively. Devesh defines the "depth of an eRAP" as the number of levels through which this property holds true. For example, the pair \((24,25)\) is of depth 2, because applying the function sum of prime factors we have \( (24,25) \Rightarrow (9,10) \Rightarrow (6,7) \)  and \( (6,7) \) is not an eRAP. Up to \(10^{13} \) there are 9 eRAPs of depth 5. The smallest one is 

It should also be noted that these number properties of Ruth-Aaron Pairs and eRAPs are independent of the number base being used as opposed say to d-powerful numbers that can be expressed in terms of the sum of various powers of their digits e.g.\( 3459872 = 3^1 + 4^6 + 5^5 + 9^6 + 8^3 + 7^7 + 2^{21} \). Generally speaking, this property only holds true in base 10. Number properties that are base-independent are intrinsically of more interest to number theorists. Primeness is perhaps the most well-known of these properties.

Sunday 28 April 2019

Average Distance Between Two Points in a Square

Figure 1: a unit square with vertices as shown
The problem of finding the average distance between two points in a unit square was treated in a YouTube video that I'll link to later in this post. My first response to the problem was to find to find an experimental answer by generating pairs of random points, finding the distance between them and then averaging these distances. Naturally I turned to SageMath and in particular its implementation on the Internet at SageMathCell.

Setting up an appropriate algorithm is rather straightforward given that the only formulae needed are the distance between two points and the mean. Here is the algorithm that I created and a permalink:

# (a, b) and (c, d) are random points on unit square
set_random_seed()
a, b, c, d=var('a, b, c, d')
sum, count=0,100000
for i in [1..count]:
   a=RR.random_element(0,1)
   b=RR.random_element(0,1)
   c=RR.random_element(0,1)
   d=RR.random_element(0,1)
   sum+=sqrt((a-c)^2+(b-d)^2)
print n(sum/count)

The first three results for this experiment involving 100000 points were: 
  • 0.520990683987433
  • 0.521024671679294
  • 0.520961814850565
Clearly the exact value to close to 0.521 but what the YouTube video dealt with was a theoretical computation, leading to an exact result and not an approximate, experimental result. Here is the video and below I'll reproduce the solution (more for my own benefit as for anyone else) as it was explained there:



STEP 1: express the distance in terms of variables \(x_1\), \(x_2\), \(y_1 \) and \(y_2\)

Figure 2: application of the distance formula to two points

STEP 2: integrate the distance over the entire area $$ \int_0^1 \,  \int_0^1 \, \int_0^1 \, \int_0^1 \sqrt{(x_1-x_2)^2+(y_1-y_2)^2} \, dx_1 \, dx_2 \, dy_1 \, dy_2$$STEP 3: simplify into \(x\) and \(y\) distances and adjust for the change in probability density functions:$$ 4 \int_0^1 \, \int_0^1 \sqrt{x^2+y^2} \, (1-x)(1-y) \, dx \,dy$$\( x_1-x_2\) and \(y_1-y_2 \) collapse to \(x\) and \(y\) respectively but \(x_1\), \(x_2\), \(y_1 \) and \(y_2\) all had probably density functions of 1 e.g. \( \int_0^1 1 \, dx_1=[x]_0^1=1\). However, with \(x=|x_1-x_2| \), the probability distribution of \(x\) is given by \(2 |1-x|\) and \(2 |1-y| )\) for \(y \). This still sums to 1 because \( \int_0^1 2|1-x| \, dx =2 \times [|x-x^2/2|]_0^1=1 \). It's called a triangular probability density function. I've no idea why and at this point in time I don't understand the underlying theory, so I'm just accepting it for the moment. Later I'll try to investigate further.

STEP 4: change to polar coordinates

Figure 3: converting to polar coordinates

We make the substitutions:

\(x=r\cos \theta \) with \(0 \leq \theta \leq \pi/4 \) and
\(y=r \sin \theta \) with \( 0 \leq r \leq 1/ \cos \theta \).

Remember that the Jacobian for this change of coordinates is \(r\) and so this means that the result must be multiplied by \(r\). Integration only ranges over the lower half of the square so the integral will also need to be multiplied by 2 as well (so multiplied by 8 overall).

STEP 5: substitute the polar coordinates into the earlier integral

The new integral becomes:$$8 \int_0^{\pi/4} \, \int_0^{1/\cos \theta} \sqrt{r^2cos^2\theta + r^2sin^2 \theta} \, (1-r \, \cos \theta) \, (1-r \, \sin \theta) \, r \,dr \, d \theta$$which simplifies to:$$8 \int_0^{\pi/4} \, \int_0^{1/\cos \theta} r \, (1-r \, \cos \theta) \, (1-r \, \sin \theta) \, r \,dr \, d \theta$$which then becomes$$8 \int_0^{\pi/4} \, \int_0^{1/\cos \theta} r^2-r^3 \, \cos \theta -r^3 \sin \theta+r^4 \, \sin \theta \, \cos \theta \,dr \, d \theta$$Integrate with respect to r and substitute the limits of integration into the result.$$\int_0^{\pi/4} \bigg ( \frac{\sec^3 \theta}{12}-\frac{\sec^3 \theta \, \tan \theta}{4}-\frac{\sec^3 \theta}{4}+\frac{\sec^3 \theta \, \tan \theta}{5}\bigg ) \, d\theta $$STEP 6: solve the simplified integral

The integral can clearly be simplified into the following form:$$\int_0^{\pi/4} \bigg ( \frac{\sec^3 \theta}{12}-\frac{\sec^3 \theta \, \tan \theta}{20} \bigg ) \, d\theta$$According to the video, the result is:$$8 \bigg [\frac{ \sec \theta \, \tan \theta + \log |\sec \theta + \tan \theta \,|}{24}-\frac{\sec^3 \theta}{60} \bigg ]_0^{\pi/4}=\frac{2+\sqrt 2+5 \log (\sqrt 2 +1)}{15}$$Of course, off the cuff I wouldn't be able to carry out those integrations, so I'm just accepting them for the moment and should really try to work them out for myself. An approximation for the previous expression is 0.521405433164721 which agrees fairly closely to what I got earlier by experimentation.

Monday 22 April 2019

Heptagonal Numbers

Today I turned 25586 days old and, as it turns out, this is a centered heptagonal number given by the formula:$$
\frac{7 n \; (n-1)}{2}+1 \text{  or  } \frac{7n^2-7n+2}{2}
$$
Figure 1: the initial centred heptagonal numbers

The initial centered heptagonal numbers are given by OEIS A069099 (note that these numbers alternate parity in the pattern odd-even-even-odd):

1, 8, 22, 43, 71, 106, 148, 197, 253, 316, 38 , 463, 547, 638, 736, 841, 953, 1072, 1198, 1331, 1471, 1618, 1772, 1933, 2101, 2276, 2458, 2647, 2843, 3046, 3256, 3473, 3697, 3928, 4166, 4411, 4663, 4922, 5188, 5461, 5741, 6028, 6322, 6623, 6931, 7246, 7568, 7897, 8233, 8576, 8926, 9283, 9647, 10018, 10396, 10781, 11173, 11572, 11978, 12391, 12811, 13238, 13672, 14113, 14561, 15016, 15478, 15947, 16423, 16906, 17396, 17893, 18397, 18908, 19426, 19951, 20483, 21022, 21568, 22121, 22681, 23248, 23822, 24403, 24991, 25586

Numbers Aplenty provides a couple of interesting formulae but nothing concerning how they were derived. The formulae are:$$\sum_{n=1}^\infty \frac{1}{H_n}=\frac{2 \pi \tanh \big ( \frac{\pi}{2\sqrt 7} \big )}{\sqrt 7} \text{  and  } \sum_{n=1}^\infty \frac{H_n}{2^n}=15$$Both are fine-looking formulae where \( \tanh \) is the hyperbolic tangent function defined as:$$ \tanh \theta = \frac{\sinh \theta}{\cosh \theta}=\frac{e^{\theta}-e^{-\theta}}{e^{\theta}+e^{- \theta}}=\frac{e^{2 \theta}-1}{e^{2 \theta}+1}$$A centered heptagonal prime is a centered heptagonal number that is prime. These primes form OEIS A144974 and the initial members of this sequence are:

43, 71, 197, 463, 547, 953, 1471, 1933, 2647, 2843, 3697, 4663, 5741, 8233, 9283, 10781, 11173, 12391, 14561, 18397, 20483, 29303, 29947, 34651, 37493, 41203, 46691, 50821, 54251, 56897, 57793, 65213, 68111, 72073, 76147, 84631, 89041

OEIS A144975 also lists a sequence of centered heptagonal twin prime numbers. Each member of this sequence is associated with its twin e.g. 43 is associated with 41 and 71 is associated with 73 etc. and the initial members of this sequence are:

43, 71, 197, 463, 1933, 5741, 8233, 9283, 11173, 14561, 34651, 41203, 57793, 68111, 84631, 104147, 139301, 168631, 207523, 244861, 307693, 333103, 357281, 415381, 465011, 475273, 506731, 592663, 595547, 607153, 729373, 742211, 781397, 876751

So far I've only focused on centered heptagonal numbers but another category of figurate numbers is the heptagonal numbers defined by the formula:$$\frac{5n^2-3n}{2}$$These numbers comprise OEIS A000566 and the initial members are:

0, 1, 7, 18, 34, 55, 81, 112, 148, 189, 235, 286, 342, 403, 469, 540, 616, 697, 783, 874, 970, 1071, 1177, 1288, 1404, 1525, 1651, 1782, 1918, 2059, 2205, 2356, 2512, 2673, 2839, 3010, 3186, 3367, 3553, 3744, 3940, 4141, 4347, 4558, 4774, 4995, 5221, 5452, 5688 

The parity of heptagonal numbers follows the pattern odd-odd-even-even. Like square numbers, the digital root in base 10 of a heptagonal number can only be 1, 4, 7 or 9. Five times a heptagonal number, plus 1 equals a triangular number.

There is an impressive formula for the sum of the reciprocals of the heptagonal numbers:$$\sum_{n=1}^\infty \frac{2}{n(5n-3)} = \frac{1}{15}{\pi}{\sqrt{25-10\sqrt{5}}}+\frac{2}{3}\ln(5)+\frac{{1}+\sqrt{5}}{3}\ln\left(\frac{1}{2}\sqrt{10-2\sqrt{5}}\right)+\frac{{1}-\sqrt{5}}{3}\ln\left(\frac{1}{2}\sqrt{10+2\sqrt{5}}\right)$$This formula and other related formulae are derived in a June 2008 paper titled Beyond the Basel Problem: Sums of Reciprocals of Figurate Numbers. The paper is not for the faint-hearted. Another paper that I stumbled upon when investigating heptagonal numbers was titled Heptagonal Numbers in the Lucas Sequence and Diophantine Equations \(x^2(5x -  3)^2 = 20y^2  \pm 16\). This paper doesn't look as formidable.

However, an article titled Project Euler 61: Find the sum of the only set of six 4-digit figurate numbers with a cyclic property on this site proved to be of the most interest. The article begins:
For some reason Problem 61 of Project Euler is a problem that not so many people have solved compared to the problems in the sixties range.  However, I think that it was a quite approachable problem which was fun to solve.  The problem reads: 
Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae: 
Triangle: \(P_{3,n}=n(n+1)/2 \) with initial members 1, 3, 6, 10, 15, …
Square: \(P_{4,n}=n^2\) with initial members 1, 4, 9, 16, 25, …
Pentagonal: \(P_{5,n}=n(3n-1)/2 \) with initial members 1, 5, 12, 22, 35, …
Hexagonal: \(P_{6,n}=n(2n-1) \) with initial members 1, 6, 15, 28, 45, …
Heptagonal: \(P_{7,n}=n(5n-3)/2 \) with initial members 1, 7, 18, 34, 55, …
Octagonal: \(P_{8,n}=n(3n-2)  \) with initial members 1, 8, 21, 40, 65, … 
The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties: 
1. The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first). 
2. Each polygonal type: triangle (\(P_{3,127}=8128 \)), square (\(P_{4,91}=8281)\), and pentagonal (\(P_{5,44}=2882 \)), is represented by a different number in the set. 
3. This is the only set of 4-digit numbers with this property. 
Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.
The author of the article provides the code he used to solve this problem. As he said, he used a brute force approach as I probably would if I were attempting it in SageMath (which I haven't tried as yet). Anyway, to cut to the chase, the six cyclic 4-digit numbers are:

1281, 8128, 2882, 8256, 5625, 2512

2512 is the heptagonal number, 1281 is octagonal, 8128 is hexagonal, 2882 is pentagonal, 8256 is triangular and 5625 is a square number (and also a centered octagonal number). 

This article got me curious about Project Euler so I decided to investigate further. Here is what I found:
About Project Euler
Leonhard Euler (1707-1783)
 
What is Project Euler? 
Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems. 
The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

Who are the problems aimed at?
 
The intended audience include students for whom the basic curriculum is not feeding their hunger to learn, adults whose background was not primarily mathematics but had an interest in things mathematical, and professionals who want to keep their problem solving and mathematics on the cutting edge.

Can anyone solve the problems?
 
The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem. So the determined participant will slowly but surely work his/her way through every problem.

What next?
 
In order to track your progress it is necessary to setup an account and have Cookies enabled. If you already have an account then Login, otherwise please Register – it's completely free! 
However, as the problems are challenging then you may wish to view the Problems before registering.
There are currently 656 problems listed and I thought it would be interesting to try to solve some of them using SageMath, so I signed up to the site. The first problem I tried was a very simple one but hey, it's a start. Here was the problem:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... 
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
The answer turns out to be 4613732 and here is the SageMath code that I used to arrive at the solution:
n=0
sum=0
while fibonacci(n)<4000000:
    if fibonacci(n) % 2==0:
        sum+=fibonacci(n)
    n=n+1
print sum
Figure 2: feedback from Project Euler
You might think it's cheating to use the fibonacci function in SageMath but it's easy enough to generate the Fibonacci sequence without resorting to it. However, it's available so I used it. Figure 2 shows the feedback I received from Project Euler. I'm encouraged to try to solve some of the other 655 problems remaining, hopefully with a higher difficulty rating.

Sunday 14 April 2019

Finance and Fibonacci

J

Just recently I chanced upon this article titled Fibonacci Numbers Are Forecasting Higher DGTX Prices and my interest was immediately piqued. To my complete surprise, I read that:
Stock market investors have been using Fibonacci (colloquially known as “Fib”) numbers for decades. The use of Fib numbers within the investing community dates back to the stock market boom of the 1920s. These days, Fibonacci numbers are more popular than ever among traders and investors. Why? Because Fib numbers work remarkably well in forecasting support and resistance levels.

The article however, didn't explain how these support and resistance levels are determined mathematically. These levels are 23.6%, 38.2%, 50% and 61.8%. On Investopedia, I found an article titled What is Fibonacci retracement, and where do its ratios come from? that explained the whole business very clearly. Of course, I didn't understand what a retracement was and nor did I really understand what was meant by support and resistance levels. Fortunately, Investopedia has a very helpful glossary of terms. Firstly, what is a Fibonacci retracement?
A Fibonacci retracement is created by taking two extreme points (usually a major peak and trough) on a stock chart and dividing the vertical distance by the key Fibonacci ratios of 23.6%, 38.2%, 50%, 61.8% and 100%. Once these levels are identified, horizontal lines are drawn and used to identify possible support and resistance levels. Source
The previous link also contains a short video. Retracement is clear enough and so what is meant by support and resistance levels?
Support, or support level, refers to the price level that an asset does not fall below for period of time. An asset's support level is created by buyers entering the market whenever the asset dips to a lower price. In technical analysis, the simple support level can be charted by drawing a line along the lowest lows for the time period being considered. Source
The previous link also contains a short video that explains the concepts of support level and resistance level succinctly.
Resistance, or a resistance level, is the price point at which the rise in the price of an asset is halted by the emergence of a growing number of sellers who wish to sell at that price. Resistance levels can be short-lived if new information comes to light that changes the overall market’s attitude toward the asset, or they can be long lasting. In terms of technical analysis, the simple resistance level can be charted by drawing a line along the highest highs for the time period being considered. Source
The Fibonacci sequence of numbers begins 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... The determination of the support and resistance levels is as follows:

  • 1st level: divide a Fibonacci number by the number immediately to its right. It's best to be a little further down the sequence so let's take 21/34 = 61.8% approximately.
  • 2nd level: divide a Fibonacci number by the number two from its right. Here 21 /55 = 38.2% approximately.
  • 3rd level: divide a Fibonacci number by the number three from its right. Here 21 /89 = 23.6% approximately.
Again to quote:
The 50% retracement level is not really a Fibonacci ratio, but it is used because of the overwhelming tendency for an asset to continue in a certain direction once it completes a 50% retracement.
Furthermore, 100% represents the peak and 0% the trough. Using the Fibonacci calculator on this site, Figure 1 shows the retracements for a peak of 500 and a trough of 200 on a downtrend (bear market):

Figure 1: retracements for a peak of 500 and a trough of 200 (downtrend)

Figure 2 shows the retracements for a trough of 200 and a peak of 500 on an upward trend (bull market):
Figure 2: retracements for a peak of 500 and a trough of 200 (uptrend)


Note that the calculator also makes use of the 76.4% mark which is 100% - 23.6% and also 138.2% = 100% + 38.2%. Figure 3 is a chart taken from a September 1st 2018 article from coindesk titled Crypto Trading 101: The Fibonacci Retracements showing the retracements in action:

Figure 3: NEO’s (NEO/BTC) 

The general consensus seems to be that used Fibonacci retracements alone are not reliable enough and they need to be combined with other indicators. There's quite a lot of information out there once you start looking. However, in this post, I was mainly interested in the mathematics underlying the calculation of these support and resistance levels and I succeeded in doing that. 

Wednesday 10 April 2019

Fields and Modular Arithmetic

I only recently became aware of the fact that a set of elements like {0, 1, 2, 3, 4, 5, 6} forms a field under modular arithmetic with modulus 7 (the number of elements in the set). The condition is that there are a prime number of elements in the set. Let's firstly define this idea of modular arithmetic:

Figure 1: extract from
https://crypto.stanford.edu/pbc/notes/numbertheory/arith.html

Now what is a field? Here's a definition from http://www.applet-magic.com/field.htm:
A field \(F\) consists of a set \(S\) of elements and two binary functions \(f \) and \(g\) defined on \(S\) and whose values are in \(S.\) Both binary functions are associative, \(f(a, f(b,c)\) is equal to \(f( f(a, b), c)\) for all \(a\), \(b\) and \(c\) in \(S\) and likewise for \(g\). The binary function \(f\), called addition is necessarily commutative; i.e., \(f(a, b)\) is equal to \(f(b,a)\) for all \(a\) and \(b\) in \(S\). The other function \(g\), called multiplication, is not necessarily commutative. There is an identity for each functions; i.e. there exist \(e\) such that \(f(e, a)=a\) for all \(a\) in \(S\) and an \(l\) such that \(g(l, a)=a\) for all \(a\) in \(S\). There exist additive inverses for all elements of \(S\) and multiplicative inverses for all elements of \(S\) except the additive identity. This means that for any element \(a\) in \(S \) there exist \(a\) and \(b\) such that \(f(a, b)=e\). Such \(a\) \(b\) is denoted as \(−a\). For any element \(a\) in \(S \) that is not \(e \) there exists \(a\) and \(b \) such that \(g(a, b)\) is equal to \(l.\) The element \(b\) is usually denoted as \(a^{−1} \). Furthermore there is distributivity of multiplication with respect to addition; i.e. \( g(a, f(b, c)) \) is equal to \( f((g(a,b), g(a, c))  \) for all \(a,\), \(b \) and \(c\) in \(S\).
The set of \(n\) x \(n\) matrices is an example of a field in which multiplication is not commutative. Putting the whole business less formally, we can say that a set of elements form a field if the set is closed under the operations of addition, subtraction, multiplication and division. In other words, these operations when applied to two elements in the set always produce a third element that is also in the set. An example is {0, 1, 2, 3, 4, 5, 6} and it is easy to set up tables for all four operations verifying the set is indeed closed, as it is under all sets with a prime number of elements. Figure 2 shows what happens to the elements of the set under the operation of multiplication by 2:

Figure 2: mapping of elements of mod 7 under multiplication by 2

Figure 3 shows the full multiplication table:

Figure 3: multiplication table for mod 7

Of course, as stated above there is no multiplicative inverse for the additive identity element. In the case of the mod 7, this element is 0 and it means we can't divide by this element just as in regular arithmetic. Figure 4 shows the full division table:

Figure 4: division table for mod 7 with case of 5 divided by 3 highlighted

Figure 5 explains the condition for division to be possible in a modular system:

Figure 4: extract from
https://crypto.stanford.edu/pbc/notes/numbertheory/arith.html

Sunday 7 April 2019

Canonical Polygons

Today I turned 25571 days old and one of the OEIS entries for this number was A052436: canonical polygons of n sides. This prompted the inevitable question: what is a canonical polygon? Well, according to MathWorld:
A canonical polygon is a closed polygon whose vertices lie on a point lattice and whose edges consist of vertical and horizontal steps of unit length or diagonal steps (at angles which are multiples of 45 degrees with respect to the lattice axes) of length \(\sqrt 2\). In addition, no two steps may be taken in the same direction, no edge intersections are allowed, and no point may be a vertex of two edges. 
On this same site, all the possible shapes for polygons with sides from 3 to 8 are shown (see Figure 1):

Figure 1: all possible canonical polygons
with sides ranging from 3 to 8

There are exactly eight distinct convex canonical polygons (see Figure 2). It is not a requirement that the canonical polygons are convex however, and a great many more shapes are possible when concave polygons are included.

Figure 2: the eight possible convex canonical polygons

For polygons with 13 sides, there are 25571 different possible configurations. Geoboard of course is a great way to experiment with the different possible shapes. Figure 4 shows a concave canonical polygon with 13 sides. It has an area of 7.5 square units (the distance between successive vertical and horizontal points on the lattice is one unit). The double area is 15 square units and this way of expressing the area is preferred because it gets rid of any 0.5 decimals. The maximum possible area of a 13-sided canonical polygon is 15.5 square units or a double area of 31 square units. There is only one such shape and that is shown in Figure 3.

Figure 3: the 13-sided canonical polygon with
maximum area of 15.5 square units

Figure 4: 13-sided canonical polygon created
using geoboard. Area is 7.5 square units.
This link to a PDF file is titled:

A052436 Examples
Lars Blomberg
February 18, 2019
Abstract
Examples of Canonical Polygons are given ordered by number of edges
and area.

The file shows examples of canonical polygons from 3 up to 18 sides. Figure 5 shows an extract from this file.

Figure 5: extract from Lars Blomberg's file showing
examples of canonical polygons with sides up to 18 

Monday 1 April 2019

42 is the new 33


A most interesting article appeared in Quanta magazine recently titled: Sum-of-Three-Cubes Problem Solved for ‘Stubborn’ Number 33. The article begins:
Mathematicians long wondered whether it’s possible to express the number 33 as the sum of three cubes — that is, whether the equation 33 = x³+ y³+ z³ has a solution. They knew that 29 could be written as 3³ + 1³ + 1³, for instance, whereas 32 is not expressible as the sum of three integers each raised to the third power. But the case of 33 went unsolved for 64 years. Now, Andrew Booker, a mathematician at the University of Bristol, has finally cracked it: 
He discovered that 
(8,866,128,975,287,528)³ + (–8,778,405,442,862,239)³ + (–2,736,111,468,807,040)³ = 33.
Apparently he used a very efficient search algorithm but he still required the use of a supercomputer running for three weeks to come up with the solution. Reading the article I also learned that there are no integer solutions to the equation x³+ y³+ z³ = n if \(n\equiv 4 \) mod 9 or \(n \equiv 5\) mod 9. Thus 31 and 32 cannot be expressed as the sums of three cubes. Of course, I've no idea why this is so and I may investigate the reason at some point in the future.

Interestingly, the only number below 100, for which a representation as a sum of three cubes has not been found, is 42. This is a number that featured in my blog post about magic cubes. Between 101 and 1000, there are 11 other "stubborn" numbers for which a representation has not been found. These numbers are 114, 165, 390, 579, 627, 633, 732, 795, 906, 921, 975. All of these numbers have the property in common that \(n\equiv 3 \) mod 9 or \(n \equiv 6\) mod 9.

The equation x³+ y³+ z³ = n is an example of a Diophantine equation (a polynomial equation whose unknown variables must take integer values). For mathematicians, "A major result would be to prove the conjecture that n = x³ + y³ + z³ has infinitely many solutions for every whole number \(n\), except those \(n\) that have a remainder of 4 or 5 after being divided by 9."

Figure 1: solutions for values of m
between 1 and 10
My source for the following information comes from here. For some such Diophantine equations, there are infinitely many solutions. For example, x³+ y³+ z³ = 1 has infinitely many solutions because of the identities:$$(1 + 9m^3)^3 + (9m^4)^3 + (-9m^4 - 3m)^3 = 1$$ $$(1 - 9m^3)^3 + (9m^4)^3 + (-9m^4 + 3m)^3 = 1$$By assigning various integer values to \(m\), the solutions unfold. Figure 1 shows an example using values of m between 1 and 10.

If we write the equation in the form:$$x^3 + y^3 + z^3 = t^3$$ and set \(t\) to be an integer then Ramanujan found that:$$x = 3n^2 + 5nm - 5m^2$$ $$y = 4n^2 - 4nm + 6m^2$$ $$z = 5n^2 - 5nm - 3m^2$$ $$t = 6n^2 - 4nm + 4m^2$$If we set \(m=1\) and \(n=2\), then \(t=20\) and \(t^3=8000\). Thus for the equation:$$x^3+y^3+z^3=8000$$there is the solution \(x=17\), \(y=14\) and \(z=7\) or $$17^3+14^3+7^3=8000$$While these results are interesting, they clearly only work for certain numbers and provide no help at all in solving a still outstanding problem like:$$x^3+y^3+z^3=42$$A specific curiosity that should be mentioned is:$$ 3^3 + 4^3 + 5^3 = 6^3$$Another is the smallest cube number that is the sum of three different positive cubes. This turns out to be 216 or 6^3 and itself the sum of \( -3^3+6^3+3^3 \). 729 or \( 9^3 \) is the next such number since \(8^3 + 6^3 + 1^1 = 729\). 729 is a perfect cube and a perfect square since \(27^2=729\).

Here is the excellent Numberphile video on YouTube in which Andrew Booker talks about his discovery:




UPDATE (7th September 2019): a solution for 42 has been found: