You are currently browsing the category archive for the ‘investigation’ category.

**Stacking cannonballs – solving maths with code**

Numberphile have recently done a video looking at the maths behind stacking cannonballs – so in this post I’ll look at the code needed to solve this problem.

**Triangular based pyramid.**

A triangular based pyramid would have:

1 ball on the top layer

1 + 3 balls on the second layer

1 + 3 + 6 balls on the third layer

1 + 3 + 6 + 10 balls on the fourth layer.

Therefore a triangular based pyramid is based on the sum of the first n triangular numbers.

The formula for the triangular numbers is:

and the formula for the sum of the first n triangular numbers is:

We can simplify this by using the identity for the sum of the first n square numbers and also the identity for the sum of the first n natural numbers:

Therefore:

and the question we want to find out is whether there is triangular based pyramid with a certain number of cannonballs which can be rearranged into a triangular number i.e.:

here n and m can be any natural number. For example if we choose n = 3 and m = 4 we see that we have the following:

Therefore we can have a triangular pyramid of height 3, which has 10 cannonballs. There 10 cannonballs can then be rearranged into a triangular number.

**Square based pyramids and above.**

For a square based pyramid we would have:

1 ball on the top layer

1 + 4 balls on the second layer

1 + 4 + 9 balls on the third layer

1 + 4 + 9 + 16 balls on the fourth layer.

This is the sum of the first n square numbers. So the formula for the square numbers is:

and the sum of the first n square numbers is:

**For a pentagonal based pyramid we have:**

1 ball on the top layer

1 + 5 balls on the second layer

1 + 5 + 12 balls on the third layer

1 + 5 + 12 + 22 balls on the fourth layer.

This is the sum of the first n pentagonal numbers. So the formula for the pentagonal numbers is:

and the formula for the first n pentagonal numbers is:

**For a hexagonal based pyramid we have:**

The formula for the first n hexagonal numbers:

and the formula for the sum of the first n hexagonal numbers:

For a **k-agon based pyramid we have**

and the formula for the sum of the first n k-agon numbers:

Therefore the general case is to ask if a k-agonal pyramid can be rearranged into a k-agon number i.e:

**Computers to the rescue**

We can then use some coding to brute force some solutions by running through large numbers of integers and seeing if any values give a solution. Here is the Python code. Type it (taking care with the spacing) into a Python editor and you can run it yourself.

You can then change the k range to check larger k-agons and also change the range for a and b. Running this we can find the following. (The first number is the value of k, the second the height of a k-agonal pyramid, the third number the k-agon number and the last number the number of cannonballs used).

**Solutions:**

3 , 3 , 4 , 10

3 , 8 , 15 , 120

3 , 20 , 55 , 1540

3 , 34 , 119 , 7140

4 , 24 , 70 , 4900

6 , 11 , 22 , 946

8 , 10 , 19 , 1045

8 , 18 , 45 , 5985

10 , 5 , 7 , 175

11 , 25 , 73 , 23725

14 , 6 , 9 , 441

14 , 46 , 181 , 195661

17 , 73 , 361 , 975061

20 , 106 , 631 , 3578401

23 , 145 , 1009 , 10680265

26 , 190 , 1513 , 27453385

29 , 241 , 2161 , 63016921

30 , 17 , 41 , 23001

32 , 298 , 2971 , 132361021

35 , 361 , 3961 , 258815701

38 , 430 , 5149 , 477132085

41 , 204 , 1683 , 55202400

41 , 505 , 6553 , 837244045

43 , 33 , 110 , 245905

44 , 586 , 8191 , 1408778281

50 , 34 , 115 , 314755

88 , 15 , 34 , 48280

145, 162, 1191, 101337426

276, 26, 77, 801801)

322, 28, 86, 1169686

823, 113, 694, 197427385

2378, 103, 604, 432684460

31265, 259, 2407, 90525801730

For example we can see a graphical representation of this. When k is 6, we have a hexagonal pyramid with height 11 or the 22nd hexagonal number – both of which give a solution of 946. These are all the solutions I can find – can you find any others? Leave a comment below if you do find any others and I’ll add them to the list!

**Crack the Beale Papers and find a $65 Million buried treasure?**

The story of a priceless buried treasure of gold, silver and jewels (worth around $65 million in today’s money) began in January 1822. A stranger by the name of Thomas Beale walked into the Washington Hotel Virginia with a locked iron box, which he gave to the hotel owner, Robert Morriss. Morriss was to look after the box for Beale as he went off on his travels.

In May 1822 Morriss received a letter from Beale which stated that the box contained papers of huge value – but that they were encoded for protection. Beale went on to ask that Morriss continue to look after the box until his return. He added that if he did not return in the next 10 years then he had instructed a close friend to send the cipher key on June 1832. After that time Morriss would be able to decipher the code and learn of the box’s secrets.

Well, Beale never returned, nor did Morriss receive the promised cipher key. Eventually he decided to open the box. Inside were three sheets of paper written in code, and an explanatory note. The note detailed that Beale had, with a group of friends discovered a seam of gold and other precious metals in Santa Fe. They had mined this over a number of years – burying the treasure in a secret location for safe keeping. The note then explained that the coded messages would give the precise location of the treasure as well as detailing which men were due a share.

Morriss devoted many years to trying to decipher the code in vain – before deciding at the age of 84 in 1862 that he should share his secret with a close friend. That friend would later publish the Beale Papers in 1885. The pamphlet that was published stirred huge interest in America – inspiring treasure hunters and amateur cryptographers to try and crack the code. The second of the 3 coded messages was cracked by the author of the pamphlet using what is known as a book code. The United States Declaration of Independence was used as the book to encode the message above.

The first number 115 refers to the 115th word in the Declaration of Independence, which is the word “instituted”. Therefore the first letter of the decoded message is “I”. The second number is 73, which refers to the 73rd word in the declaration – which is “hold”, so the second letter of the decoded message is “h”. Following this method, the following message was revealed:

*I have deposited in the county of Bedford, about four miles from Buford’s, in an excavation or vault, six feet below the surface of the ground, the following articles, belonging jointly to the parties whose names are given in number three, herewith:*

*The first deposit consisted of ten hundred and fourteen pounds of gold, and thirty-eight hundred and twelve pounds of silver, deposited Nov. eighteen nineteen. The second was made Dec. eighteen twenty-one, and consisted of nineteen hundred and seven pounds of gold, and twelve hundred and eighty-eight of silver; also jewels, obtained in St. Louis in exchange for silver to save transportation, and valued at thirteen thousand dollars.*

*The above is securely packed in iron pots, with iron covers. The vault is roughly lined with stone, and the vessels rest on solid stone, and are covered with others. Paper number one describes the exact locality of the vault, so that no difficulty will be had in finding it. Source*

After the pamphlet was published there was great interest in cracking the 2 remaining papers, an interest which has persisted into modern times. One of the uncracked papers is shown below:

In 1983 2 amateur treasure hunters were jailed for trying to dig up graves in Bedford, sure that they were about to find the missing gold. In 1989 a professional treasure hunter called Mel Fisher secretly bought a large plot of land after believing that the treasure was buried underneath. However nothing was found. Up until now all efforts to crack the code above have ended in failure. Perhaps the pamphlet was a giant hoax? Or perhaps the treasure is still waiting to be found.

The town of Bedford still receives visitors from around the world, keen to try and crack this centuries old puzzle. You can hire metal detectors and go looking for it yourself. The map above from 1891 shows the 4 mile radius from Buford’s tavern which is thought to contain the treasure. Maybe one day Beale’s papers will finally be cracked.

For more information on this topic read Simon Singh’s excellent The Code Book – which has more details on this case and many other code breaking puzzles throughout history.

If you want to try your own codebreaking skills, head over to our Schoolcodebreaking site – to test your wits against students from schools around the world!

**Projective Geometry**

Geometry is a discipline which has long been subject to mathematical fashions of the ages. In classical Greece, Euclid’s elements (Euclid pictured above) with their logical axiomatic base established the subject as the pinnacle on the “great mountain of Truth” that all other disciplines could but hope to scale. However the status of the subject fell greatly from such heights and by the late 18th century it was no longer a fashionable branch to study. The revival of interest in geometry was led by a group of French mathematicians at the start of the 1800s with their work on projective geometry. This then paved the way for the later development of non-Euclidean geometry and led to deep philosophical questions as to geometry’s links with reality and indeed just what exactly geometry was.

Projective geometry is the study of geometrical properties unchanged by projection. It strips away distinctions between conics, angles, distance and parallelism to create a geometry more fundamental than Euclidean geometry. For example the diagram below shows how an ellipse has been projected onto a circle. The ellipse and the circle are therefore projectively equivalent which means that projective results in the circle are also true in ellipses (and other conics).

Projective geometry can be understood in terms of rays of light emanating from a point. In the diagram above, the triangle IJK drawn on the glass screen would be projected to triangle LNO on the ground. This projection does not preserve either angles or side lengths – so the triangle on the ground will have different sized angles and sides to that on the screen. This may seem a little strange – after all we tend to think in terms of angles and sides in geometry, however in projective geometry distinctions about angles and lengths are stripped away (however something called the cross-ratio is still preserved).

We can see in the image above that a projection from the point E creates similar shapes when the 2 planes containing IJKL and ABCD are parallel. Therefore the Euclidean geometrical study of similar shapes can be thought of as a subset of plane positions in projective geometry.

Taking this idea further we can see that congruent shapes can be achieved if we have the centre of projection, E, “sent to infinity:” In projective geometry, parallel lines do indeed meet – at this point at infinity. Therefore with the point E sent to infinity we have a projection above yielding congruent shapes.

Projective geometry can be used with conics to associate every point (pole) with a line (polar), and vice versa. For example the point A had the associated red line, d. To find this we draw the 2 tangents from A to the conic. We then join the 2 points of intersection between B and C. This principle of duality allowed new theorems to be discovered simply by interchanging points and lines.

An example of both the symmetrical attractiveness and the mathematical potential for duality was first provided by Brianchon. In 1806 he used duality to discover the dual theorem of Pascal’s Theorem – simply by interchanging points and lines. Rarely can a mathematical discovery have been both so (mechanically) easy and yet so profoundly

beautiful.

**Brianchon’s Theorem**

**Pascal’s Theorem**

**Poncelet**

Poncelet was another French pioneer of projective geometry who used the idea of points and lines being “sent to infinity” to yield some remarkable results when used as a tool for mathematical proof.

**Another version of Pascal’s Theorem:**

Poncelet claimed he could prove Pascal’s theorem (shown above) where 6 points on a conic section joined to make a hexagon have a common line. He did this by sending the line GH to infinity. To understand this we can note that the previous point of intersection G of lines AB’ and A’B is now at infinity, which means that AB’ and A’B will now be parallel. This means that H being at infinity also creates the 2 parallel lines AC’. Poncelet now argued that because we could prove through geometrical means that B’C and BC’ were also parallel, that this was consistent with the line HI also being at infinity. Therefore by proving the specific case in a circle where line GHI has been sent to infinity he argued that we could prove using projective geometry the general case of Pascal’s theorem in any conic .

**Pascal’s Theorem with intersections at infinity:**

This branch of mathematics developed quickly in the early 1800s, sparking new interest in geometry and leading to a heated debate about whether geometry should retain its “pure” Euclidean roots of diagrammatic proof, or if it was best understood through algebra. The use of points and lines at infinity marked a shift away from geometry representing “reality” as understood from a Euclidean perspective, and by the late 1800s Beltrami, Poincare and others were able to incorporate the ideas of projective geometry and lines at infinity to provide their Euclidean models of non-Euclidean space. The development of projective geometry demonstrated how a small change of perspective could have profound consequences.

This is a nice example of using some maths to solve a puzzle from the mindyourdecisions youtube channel (screencaptures from the video).

**How to Avoid The Troll: A Puzzle**

In these situations it’s best to look at the extreme case first so you get some idea of the problem. If you are feeling particularly pessimistic you could assume that the troll is always going to be there. Therefore you would head to the top of the barrier each time. This situation is represented below:

**The Pessimistic Solution:**

Another basic strategy would be the optimistic strategy. Basically head in a straight line hoping that the troll is not there. If it’s not, then the journey is only 2km. If it is then you have to make a lengthy detour. This situation is shown below:

**The Optimistic Solution:**

The expected value was worked out here by doing 0.5 x (2) + 0.5 x (2 + root 2) = 2.71.

The question is now, is there a better strategy than either of these? An obvious possibility is heading for the point halfway along where the barrier might be. This would make a triangle of base 1 and height 1/2. This has a hypotenuse of root (5/4). In the best case scenario we would then have a total distance of 2 x root (5/4). In the worst case scenario we would have a total distance of root(5/4) + 1/2 + root 2. We find the expected value by multiply both by 0.5 and adding. This gives 2.63 (2 dp). But can we do any better? Yes – by using some algebra and then optimising to find a minimum.

**The Optimisation Solution:**

To minimise this function, we need to differentiate and find when the gradient is equal to zero, or draw a graph and look for the minimum. Now, hopefully you can remember how to differentiate polynomials, so here I’ve used Wolfram Alpha to solve it for us. Wolfram Alpha is incredibly powerful -and also very easy to use. Here is what I entered:

and here is the output:

So, when we head for a point exactly 1/(2 root 2) up the potential barrier, we minimise the distance travelled to around 2.62 miles.

So, there we go, we have saved 0.21 miles from our most pessimistic model, and 0.01 miles from our best guess model of heading for the midpoint. Not a huge difference – but nevertheless we’ll save ourselves a few seconds!

This is a good example of how an exploration could progress – once you get to the end you could then look at changing the question slightly, perhaps the troll is only 1/3 of the distance across? Maybe the troll appears only 1/3 of the time? Could you even generalise the results for when the troll is y distance away or appears z percent of the time?

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

**The Telephone Numbers – Graph Theory**

The telephone numbers are the following sequence:

1, 1, 2, 4, 10, 26, 76, 232, 764, 2620, 9496…

(where we start from n=0).

This pattern describes the total number of ways which a telephone exchange with n telephones can place a connection between pairs of people.

To illustrate this idea, the graph below is for n=4. This is when we have 10 telephones:

Each red line represents a connection. So the first diagram is for when we have no connections (this is counted in our sequence). The next five diagrams all show a single connection between a pair of phones. The last three diagrams show how we could have 2 pairs of telephones connected at the same time. Therefore the 4th telephone number is 10. These numbers get very large, very quickly.

**Finding a recursive formula**

The formula is given by the recursive relationship:

**T(n) = T(n-1) + (n-1)T(n-2)**

This means that to find (say) the 5th telephone number we do the following:

**T(5) = T(5-1) + (5-1)T(5-2)**

**T(5) = T(4) + (4)T(3)**

**T(5) = 10 + (4)4**

**T(5) = 26**

This is a quick way to work out the next term, as long as we have already calculated the previous terms.

**Finding an nth term formula
**

The telephone numbers can be calculated using the nth term formula:

This is going to be pretty hard to derive! I suppose the first step would start by working out the total number of connections possible between n phones – and this will be the the same as the graphs below:

These clearly follow the same pattern as the triangular numbers which is 0.5(n² +n) when we start with n = 1. We can also think of this as n choose 2 – because this gives us all the ways of linking 2 telephones from n possibilities. Therefore n choose 2 also generates the triangular numbers.

But then you would have to work out all the permutations which were allowed – not easy!

Anyway, as an example of how to use the formula to calculate the telephone numbers, say we wanted to find the 5th number:

We have n = 5. The summation will be from k = 0 and k = 2 (as 5/2 is not an integer).

Therefore T(5) = 5!/(2^{0}(5-0)!0!) + 5!/(2^{1}(5-2)!1!) + 5!/(2^{2}(5-4)!2!)

T(5) = 1 + 10 + 15 = 26.

**Finding telephone numbers through calculus**

Interestingly we can also find the telephone numbers by using the function:

y = e^{0.5x2+x}

and the nth telephone number (starting from n = 1) is given by the nth derivative when x = 0.

For example,

So when x = 0, the third derivative is 4. Therefore the 3rd telephone number is 4.

The fifth derivative of the function is:

So, when x =0 the fifth derivative is 26. Therefore the 5th telephone number is 26.

If you liked this post you might also like:

Fermat’s Theorem on the Sum of two Squares – A lesser known theorem from Fermat – but an excellent introduction to the idea of proof.

Unbelievable: 1+2+3+4…. = -1/12 ? A result that at first glance looks ridiculous – and yet can be shown to be correct. How?

**Happy Numbers**

Happy numbers are defined by the rule that you start with any positive integer, square each of the digits then add them together. Now do the same with the new number. Happy numbers will eventually spiral down to a number of 1. Numbers that don’t eventually reach 1 are called unhappy numbers.

As an example, say we start with the number 23. Next we do 2²+3² = 13. Now, 1²+3² = 10. Now 1²+o² = 1. 23 is therefore a happy number.

There are many things to investigate. What are the happy numbers less than 100? Is there a rule which dictates which numbers are happy? Are there consecutive happy numbers? How about prime happy numbers? Can you find the infinite cycle of sadness?

Nrich has a discussion on some of the maths behind happy numbers. You can use an online tool to test if numbers are happy or sad.

Perfect numbers are numbers whose proper factors (factors excluding the number itself) add to the number. This is easier to see with an example.

6 is a perfect number because its proper factors are 1,2,3 and 1+2+3 = 6

8 is not a perfect number because its proper factors are 1,2,4 and 1+2+4 = 7

Perfect numbers have been known about for about 2000 years – however they are exceptionally rare. The first 4 perfect numbers are 6, 28, 496, 8128. These were all known to the Greeks. The next perfect number wasn’t discovered until around 1500 years later – and not surprisingly as it’s 33,550,336.

The next perfect numbers are:

8,589,869,056 (discovered by Italian mathematician Cataldi in 1588)

137,438,691,328 (also discovered by Cataldi)

2,305,843,008,139,952,128 (discovered by Euler in 1772).

and they keep getting bigger. The next number to be discovered has 37 digits are was discovered over 100 years later. Today, even with vast computational power, only a total of 48 perfect numbers are known. The largest has 34,850,340 digits.

There are a number of outstanding questions about perfect numbers. Are there an infinite number of perfect numbers? Is there any odd perfect number?

Euclid in around 300BC proved that that 2^{p−1}(2^{p}−1) is an even perfect number whenever 2^{p}−1 is prime. Euler (a rival with Euclid for one of the greatest mathematicians of all time), working on the same problem about 2000 years later went further and proved that this formula will provide *every* even perfect number.

This links perfect numbers with the search for Mersenne Primes – which are primes in the form 2^{p}−1. These are themselves very rare, but every new Mersenne Prime will also yield a new perfect number.

The first Mersenne Primes are

(2^{2}−1) = 3

(2^{3}−1) = 7

(2^{5}−1) = 31

(2^{7}−1) = 127

Therefore the first even perfect numbers are:

2^{1}(2^{2}−1) = 6

2^{2}(2^{3}−1) = 28

2^{4}(2^{5}−1) = 496

2^{6}(2^{7}−1) = 8128

**Friendly Numbers**

Friendly numbers are numbers which share a relationship with other numbers. They require the use of σ(a) which is called the divisor function and means the addition of all the factors of a. For example σ(7) = 1 + 7 = 8 and σ(10) = 1 +2 +5 + 10 = 18.

Friendly numbers therefore satisfy:

σ(a)/a = σ(b)/b

As an example (from Wikipedia)

σ(6) / 6 = (1+2+3+6) / 6 = 2,

σ(28) / 28 = (1+2+4+7+14+28) / 28 = 2

σ(496)/496 = (1+2+4+8+16+31+62+124+248+496)/496 = 2

Therefore 28 and 6 are friendly numbers because they share a common relationship. In fact all perfect numbers share the same common relationship of 2. This is because of the definition of perfect numbers above!

Numbers who share the same common relationship are said to be in the same club. For example, 30,140, 2480, 6200 and 40640 are all in the same club – because they all share the same common relationship 12/5.

(eg. σ(30) /30 = (1+2+3+5+6+10+15+30) / 30 = 12/5 )

Are some clubs of numbers infinitely big? Which clubs share common integer relationships? There are still a number of unsolved problems for friendly numbers.

**Solitary Numbers**

Solitary numbers are numbers which don’t share a common relationship with any other numbers. All primes, and prime powers are solitary.

Additionally all number that satisfy the following relationship:

HCF of σ(a) and a = 1.

are solitary. All this equation means is that the highest common factor (HCF) of σ(a) and a is 1. For example lets choose the number 9.

σ(9)= 1+3+9 = 13. The HCF of 9 and 13 = 1. So 9 is solitary.

However there are some numbers which are not prime, prime powers or satisfy HCF (σ(a) and a) = 1, but which are still solitary. These numbers are much harder to find! For example it is believed that the following numbers are solitary:

10, 14, 15, 20, 22, 26, 33, 34, 38, 44, 46, 51, 54, 58, 62, 68, 69, 70, 72, 74, 76, 82, 86, 87, 88, 90, 91, 92, 94, 95, 99

But no-one has been able to prove it so far. Maybe you can!

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

This carries on the previous investigation into Farey sequences, and is again based on the current Nrich task Ford Circles. Below are the Farey sequences for F_{2}, F_{3} and F_{4}. You can read about Farey sequences in the previous post.

This time I’m going to explore the link between Farey sequences and circles. First we need the general equation for a circle:

This has centre (p,q) and radius r. Therefore

**Circle 1:**

has centre:

and radius:

**Circle 2:**

has centre:

and radius:

Now we can plot these circles in Geogebra – and look for the values of a,b,c,d which lead to the circles touching at a point.

**When a = 1, b = 2, c = 2, d = 3:**

Do we notice anything about the numbers a/b and c/d ? a/b = 1/2 and c/d = 2/3 ? These are consecutive terms in the F_{3 }sequence. So do other consecutive terms in the Farey sequence also generate circles touching at a point?

**a = 1, b = 1, c = 2, d = 3**

Again we can see that the fractions 1/1 and 2/3 are consecutive terms in the F_{3 }sequence. So by drawing some more circle we can graphically represent all the fractions in the F_{3 }sequence:

So these four circles represent the four non-zero fractions of in the F_{3 }sequence!

and this is the visual representation of the non-zero fractions of in the F_{4 }sequence. Amazing!

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

This is a mini investigation based on the current Nrich task Farey Sequences.

As Nrich explains:

I’m going to look at Farey sequences (though I won’t worry about rearranging them in order of size). Here are some of the first Farey sequences. The missing fractions are all ones which simplify to a fraction already on the list (e.g. 2/4 is missing because this is the same as 1/2)

You should be able to notice that the next Farey sequence always contains the previous Farey sequence, so the problem becomes working out which of the new fractions added will not cancel down to something already on the list.

**Highest Common Factors**

Fractions will not cancel down (simplify) if the numerator and denominator have a highest common factor (HCF) of 1. For example 2/4 simplifies because the highest common factor of 2 and 4 is 2. Therefore both top and bottom can be divided by 2. 4/5 does not simplify because the HCF of 4 and 5 is 1.

We call 2 numbers which have a HCF of 1 **relatively prime.**

for example for the number 4: 1 and 3 are both relatively prime (HCF of 1 and 4 =1, HCF of 3 and 4 = 1).

**Relatively prime numbers**

2: 1

3: 1,2

4: 1,3

5: 1,2,3,4

6: 1,5

7: 1,2,3,4,5,6

8: 1,3,5,7

9: 1,2,4,5,7,8

You might notice that these give the required numerators for any given denominator – i.e when the denominator is 9, we want a numerator of 1,2,4,5,7,8.

**Euler totient function**

Euler’s totient function is a really useful function in number theory – which counts the number of relatively prime numbers a given number has. For example from our list we can see that 9 has 6 relatively prime numbers.

Euler’s totient function is defined above – it’s not as complicated as it looks! The strange symbol on the right hand side is the product formula – i.e we multiply terms together. It’s easiest to understand with some examples. To find Euler’s totient function we first work out the prime factors of a number. Say we have the number 8. The prime factors of 8 are 2^{3}. Therefore the only unique prime factor is 2.

Therefore the Euler totient function tells me to simply do 8 (1 – 1/2) = 4. This is how many relatively prime numbers 8 has.

Let’s look at another example – this time for the number 10. 10 has the prime factorisation 5 x 2. Therefore it has 2 unique primes, 2 and 5. Therefore the Euler totient function tells me to do 10(1-1/2)(1-1/5) = 4.

One more example, this time with the number 30. This has prime factorisation 2 x 3 x 5. This has unique prime factors 2,3,5 so I will do 30(1 -1/2)(1-1/3)(1-1/5) =8.

**An equation for the number of fractions in the Farey sequence**

Therefore I can now work out how many fractions will appear in a given Farey sequence. I notice that for (say) F_{5} I will add Euler’s totient for n = 2, n = 3, n = 4 and n = 5. I then add 2 to account for 0/1 and 1/1. Therefore I have:

For example to find F_{6}

There are lots of things to investigate about Farey functions – could you prove why all Farey sequences have an odd number of terms? You can also look at how well the Farey sequence is approximated by the following equation:

For example when n = 10 this gives:

and when n = 1000 this gives:

These results compare reasonably well as an estimation to the real answers of 33 and 304,193 respectively.

**IB Revision**

**Circular Motion: Modelling a ferris wheel**

This is a nice simple example of how the Tracker software can be used to demonstrate the circular motion of a Ferris wheel. This is sometimes asked in IB maths exams – so it’s nice to get a visual representation of what is happening.

First I took a video from youtube of a Ferris wheel, loaded it into Tracker, and then used the program to track the position of a single carriage as it moved around the circle. I then used Tracker’s graphing capabilities to plot the height of the carriage (y) against time (t). This produces the following graph:

As we can see this is a pretty good fit for a sine curve. So let’s use the regression tool to find what curve fits this:

The pink curve with the equation:

y = -116.1sin(0.6718t+2.19)

fits reasonably well. If we had the original dimensions of the wheel we could scale this so the y scale represented the metres off the ground of the carriage.

There we go! Short and simple, but a nice starting point for an investigation on circular motion.

**IB Revision**

**Project Euler: Coding to Solve Maths Problems**

Project Euler, named after one of the greatest mathematicians of all time, has been designed to bring together the twin disciplines of mathematics and coding. Computers are now become ever more integral in the field of mathematics – and now creative coding can be a method of solving mathematics problems just as much as creative mathematics has always been.

The first problem on the Project Euler Page is as follows:

*If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.*

*Find the sum of all the multiples of 3 or 5 below 1000.*

This is a reasonably straight forward maths problem which we can solve using the summation of arithmetic sequences (I’ll solve it below!) but more interestingly is how a computer code can be written to solve this same problem. Given that I am something of a coding novice, I went to the Project Nayuki website which has an archive of solutions. Here is a slightly modified version of the solution given on Project Nayki, designed to run in JAVA:

The original file can be copied from here, I then pasted this into an online JAVA site jdoodle. The only modification necessary was to replace:

*public final class p001 implements EulerSolution* with *public class p001*

Then after hitting execute you get the following result:

i.e the solution is returned as 233,168. Amazing!

But before we get carried away, let’s check the answer using some more old fashioned maths. We can break down the question into simply trying to find the sum of multiples of 3 under 1000, the sum of the multiples of 5 under 1000 and then subtracting the multiples of 15 under 1000 (as these will have been double counted). i.e:

(3 + 6 + 9 + … 999) + (5 + 10 + 15 + … 995) – (15 + 30 + 45 + …990)

This gives:

S_333 = 333/2 (2(3)+ 332(3)) = 166,833

+

S_199 = 199/2 (2(5) + 198(5)) = 99, 500

–

S_66 = 66/2 (2(15) +65(15) = 33, 165.

166,833 + 99, 500 – 33, 165 = 233, 168 as required.

Now that we have seen that this works we can modify the original code. For example if we replace:

if (i % 3 == 0 || i % 3 == 0)

with

if (i % 5 == 0 || i % 7 == 0)

This will find the sum of all the multiples of 5 or 7 below 1000. Which returns the answer 156,361.

Replacing the same line with:

if (i % 5 == 0 || i % 7 == 0 || i % 3 == 0)

will find the sum of all the multiples of 3 or 5 or 7 below 1000, which returns the answer 271,066. To find this using the previous method we would have to do:

Sum of 3s + Sum of 5s – Sum of 15s + Sum of 7s – Sum of 21s – Sum 35s – Sum of 105s. Which starts to show why using a computer makes life easier.

This would be a nice addition to any investigation on Number Theory – or indeed a good project for anyone interested in Computer Science as a possible future career.