**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!

]]>**Plotting the Mandelbrot Set **

The video above gives a fantastic account of how we can use technology to generate the Mandelbrot Set – one of the most impressive mathematical structures you can imagine. The Mandelbrot Set can be thought of as an infinitely large picture – which contains fractal patterns no matter how far you enlarge it. Below you can see a Mandelbrot zoom – which is equivalent to starting with a piece of A4 paper and enlarging it to the size of the universe! Even at this magnification you would still see new patterns emerging.

The way the Mandelbrot set is formed in the first video is by using the following iterative process:

Z_{n+1} = Z_{n}^{2} + c

Here Z is a complex number (of the form a + bi) and c is a constant that we choose. We choose our initial Z value as 0. Z_{1} = 0. We then choose a value of c (which is also a complex number) and see what happens when we follow the iterative process.

Let’s choose c = 2i +1. Z_{1} = 0

Z_{n+1} = Z_{n}^{2} + 2i +1

Z_{2} = (0)^{2} + 2i +1

Z_{2} = 2i + 1

We then repeat this process:

Z_{3} = Z_{2}^{2} + 2i +1

Z_{3} = (2i+1)^{2} + 2i +1

Z_{3} = (2i)(2i) + 2i + 2i + 1 + 2i +1

Z_{3} = 6i-2 (as i.i = -1)

As we continue this process Z_{n} spirals to infinity.

What we are looking for is whether this iterated Z value will diverge to infinity (i.e get larger and larger) or if it will remain bounded. If diverges to infinity we colour the initial point 2i+1 as blue on a complex axis. If it remains bounded we will colour it in black. In this case our initial point 2i+1 will diverge to infinity and so it will be coloured in blue.

So, let’s use Geogebra to see this is action. The Geogrebra online program for this is here.

We choose a value for c. Let’s say c = 0.23 + 0.42i. Z_{1} = 0

Z_{n+1} = Z_{n}^{2} + 0.23 + 0.42i.

Z_{2} = (0)^{2} + 0.23 + 0.42i.

Z_{2} = 0.23 + 0.42i.

Z_{3} = Z_{2}^{2} + 0.23 + 0.42i.

Z_{3} = (0.23 + 0.42i.)^{2} + 0.23 + 0.42i.

Z_{3} = 0.1065 + 0.6132i

Z_{4} = (0.1065 + 0.6132i)^{2} + 0.23 + 0.42i.

Z_{4} = -0.13467199 + 0.5506116i

We carry on with this iterative process and plot the points that we get each time. We can see the (0.23, 0.42), (0.1065, 0.42) and (-0.13467199, 0.5506116) correspond to the first coordinates on the spiral after (0,0). We can see that as this process continues we see a convergence to a point close to (0.05, 0.45).

If we choose another starting value for c: c = 0.17 + 0.56i we get the following diagram:

Again we have a stable spiral which spirals around a geometric shape and does not diverge to infinity.

If we choose another starting value for c: c = -0.25 + 0.64i we get the following diagram:

If we choose another starting value for c: c = 0.11 + 0.59i we get the following diagram:

However, If we choose another starting value for c: c = 0.3 + 0.68i we get the following diagram:

This time we can see that the orbit of points does not converge, but instead it diverges to infinity.

We can then colour in each point – simply categorising whether the value of c leads to an orbit which diverges or remains bounded. Black means it remains bounded, blue that it has escaped to infinity. So, below we can see that when we do the iterative process with c = 0.39+ 0.63i our orbit will escape to infinity (as it is coloured blue)

If we do this exercise in much finer detail we arrive at the following picture:

This is the Mandelbrot Set – and will keep producing fractal patterns as you zoom in to infinity.

]]>

**What’s so special about 277777788888899?**

Numberphile have just done a nice video which combines mathematics and computer programing. The challenge is to choose any number (say 347)

Then we do 3x4x7 = 84

next we do 8×4 = 32

next we do 3×2 = 6.

And when we get to a single digit number then we have finished. It took 3 steps to get from 347 to a single digit number, therefore 347 has a *persistence* of 3. The challenge is to find a number with as big a persistence as possible. The current world record is 277777788888899 which is the smallest number with a persistence of 11. No numbers with a persistence of greater than 11 have ever been found. In the video Matt writes a Python program to check this, though I tried to make my own version below. It’s not very sophisticated, but it gets the job done (with a small glitch of returning a 0 followed by 1s when it should just return 0s!)

The full code should be available to run here, or download here. If you run the program above in an online Python site like repl.it you can choose any number you like as see what its persistence is.

If you find any number that hasn’t gone to a single digit after 11 rounds, you’ve found a new world record persistence!

To very briefly explain the code used above:

We start by defining “result” as 1. We then have some add any integer number on the screen (let’s use 347). We then do 347 mod 10 (number % 10) which gives 7, and do result (which is 1) multiplied by 7. We then do 347 divided by 10 ignoring remainders (number//10). This gives 34.

We then start the process again. 34 mod 10 = 4. So now we have 1 x 7 x 4. Next we do 34 divided by 10 ignoring remainders which gives 3. Last we do 3 mod 10 = 3. So we have 1 x 7 x 4 x 3. If we carried on the loop we would next have 3/10 = 0 ignoring remainders, therefore our loop would stop.

The program then defines the *new* starting number as 7x4x3 = 84 and then starts again. So, a nice use of mathematics and computing – see what levels of persistence you can find!

**Normal Numbers – and random number generators**

Numberphile have a nice new video where Matt Parker discusses all different types of numbers – including “normal numbers”. Normal numbers are defined as irrational numbers for which the probability of choosing any given 1 digit number is the same, the probability of choosing any given 2 digit number is the same etc. For example in the normal number 0.12345678910111213141516… , if I choose any digit in the entire number at random P(1) = P(2) = P(3) = … P(9) = 1/10. Equally if I choose any 2 digit number at random I have P(10) = P(11) = P(12) = P(99) = 1/100.

It is incredibly hard to find normal numbers, but there is a formula to find some of them.

In base 10, we are restricted to choosing a value of c such that 10 and c are relatively prime (i.e share no common factors apart from 1). So if we choose c = 3 this gives:

We can now put this into Wolfram Alpha and see what number this gives us:

So we can put the first few digits into an online calculator to find the distributions

*0.000333333444444444444448148148148148148148148148148148148148148149382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049827160493827160493827160479423863312 7572016460905349794238683127572016460905349794238683127572016460 9053497942386831275720164609053497942386831275720164609053497942*

4: 61

1: 41

8: 40

3: 38

0: 36

2: 33

7: 33

9: 33

6: 32

5: 10

We can see that we are already seeing a reasonably similar distribution of single digits, though with 4 and 5 outliers. As the number progressed we would expect these distributions to even up (otherwise it would not be a normal number).

One of the potential uses of normal numbers is in random number generators – if you can use a normal number and specify a digit (or number of digits) at random then this should give an equal chance of returning each number.

To finish off this, let’s prove that the infinite series:

does indeed converge to a number (if it diverged then it could not be used to represent a real number). To do that we can use the ratio test (only worry about this bit if you have already studied the Calculus Option for HL!):

We can see that in the last limit 3 to the power n+1 will grow faster than 3 to the power n, therefore as n increases the limit will approach 0. Therefore by the ratio test the series converges to a real number.

**Is pi normal?**

Interestingly we don’t know if numbers like e, pi and ln(2) are normal or not. We can analyse large numbers of digits of pi – and it looks like it will be normal, but as yet there is no proof. Here are the distribution of the first 100,000 digits of pi:

1: 10137

6: 10028

3: 10026

5: 10026

7: 10025

0: 9999

8: 9978

4: 9971

2: 9908

9: 9902

Which we can see are all very close to the expected value of 10,000 (+/- around 1%).

So, next I copied the first 1 million digits of pi into a character frequency counter which gives the following:

5: 100359

3: 100230

4: 100230

9: 100106

2: 100026

8: 99985

0: 99959

7: 99800

1: 99758

6: 99548

This is even closer to the expected values of 100,000 with most with +/- 0.25 %.

Proving that pi is normal would be an important result in number theory – perhaps you could be the one to do it!

]]>

**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!

]]>**Volume optimization of a cuboid**

This is an extension of the Nrich task which is currently live – where students have to find the maximum volume of a cuboid formed by cutting squares of size x from each corner of a 20 x 20 piece of paper. I’m going to use an n x 10 rectangle and see what the optimum x value is when n tends to infinity.

First we can find the volume of the cuboid:

Next we want to find when the volume is a maximum, so differentiate and set this equal to 0.

Next we use the quadratic formula to find the roots of the quadratic, and then see what happens as n tends to infinity (i.e we want to see what the optimum x values are for our cuboid when n approaches infinity). We only take the negative solution of the + – quadratic solutions because this will be the only one that fits the initial problem.

Next we try and simplify the square root by taking out a factor of 16, and then we complete the square for the term inside the square root (this will be useful next!)

Next we make a u substitution. Note that this means that as n approaches infinity, u approaches 0.

Substituting this into the expression gives us:

We then manipulate the surd further to get it in the following form:

Now, the reason for all that manipulation becomes apparent – we can use the binomial expansion for the square root of 1 + u^{2} to get the following:

Therefore we have shown that as the value of n approaches infinity, the value of x that gives the optimum volume approaches 2.5cm.

So, even though we start with a pretty simple optimization task, it quickly develops into some quite complicated mathematics. We could obviously have plotted the term in n to see what its behavior was as n approaches infinity, but it’s nicer to prove it. So, let’s check our result graphically.

As we can see from the graph, with n plotted on the x axis and x plotted on the y axis we approach x = 2.5 as n approaches infinity – as required.

**An m by n rectangle.**

So, we can then extend this by considering an n by m rectangle, where m is fixed and then n tends to infinity. As before the question is what is the value of x which gives the maximum volume as n tends to infinity?

We do the same method. First we write the equation for the volume and put it into the quadratic formula.

Next we complete the square, and make the u substitution:

Next we simplify the surd, and then use the expansion for the square root of 1 + u^{2}

This then gives the following answer:

So, we can see that for an n by m rectangle, as m is fixed and n tends to infinity, the value of x which gives the optimum volume tends to m/4. For example when we had a 10 by n rectangle (i.e m = 10) we had x = 2.5. When we have a 20 by n rectangle we would have x = 5 etc.

And we’ve finished! See what other things you can explore with this problem.

]]>

**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.

]]>**Narcissistic Numbers**

Narcissistic Numbers are defined as follows:

An n digit number is narcissistic if the sum of its digits to the nth power equal the original number.

For example with 2 digits, say I choose the number 36:

3^{2} + 6^{2} = 45. Therefore 36 is not a narcissistic number, as my answer is not 36.

For example with 3 digits, say I choose the number 124:

1^{3} + 2^{3} + 4^{3} = 73. Therefore 124 is not a narcissistic number as my answer is not 124.

The question is how to find all the narcissistic numbers less than 1000, without checking 1000 different numbers? Let’s start with 1 digit numbers.

**1 digit numbers**

0^{1} = 0

1^{1} = 1

2^{1} = 2 etc.

Therefore all numbers from 0-9 are narcissistic.

**2 digit numbers**

For 2 digit numbers in the form ab we need the following:

a^{2} + b^{2} = 10a + b.

Therefore

a^{2} – 10a + b^{2} – b = 0.

Next if we choose a = 1,2,3,4,5 we get the following simultaneous equations:

b^{2} – b -16 = 0

b^{2} – b -21 = 0

b^{2} – b -24 = 0

b^{2} – b -25 = 0

None of these factorise for integer solutions, therefore there are no 2 digit solutions from 11 to 59. Trying a = 6,7,8,9 we find that we get the same as the first four equations. This is because a and 10-a give equivalent solutions. In other words, when a = 1 we get the equation b^{2} – b -9 = 0 and when a = 9 we also get the equation b^{2} – b -9 = 0. This is because:

for:

a^{2} – 10a

if we substitute a = (10 – a) we get

(10 – a)^{2} – 10(10 – a) = a^{2} – 10a.

Therefore we prove that there are no 2 digit narcissistic numbers.

**3 digit numbers**

First we list the cube numbers:

1^{3} = 1, 2^{3} = 8, 3^{3} = 27, 4^{3} = 64, 5^{3} = 125, 6^{3} = 216, 7^{3} = 343, 8^{3} = 512, 9^{3} = 729.

and then consider 3 digit numbers of the form 1bc first. We need:

1^{3}+ b^{3} + c^{3} = 100 + 10b + c.

If our first digit is 1, then b^{3} + c^{3} need to add up to give us a number in the one hundreds, therefore:

99 ≤ ^{ }b^{3} + c^{3}≤ 198.

We can then check the cube numbers and see that the only possible combinations for a and b are 0 5, 5 0, 1 5, 5 1, 2 5, 5 2, 3 5, 5 3, 4 4, 4 5, 5 4. We can check these (only have to use the calculator for half as the reversed numbers give equivalent answers) and find that for 153 we do indeed get a narcissistic number i.e:

1^{3}+ 5^{3} + 3^{3} = 153.

Next we consider 3 digit numbers of the form 2bc first. We need:

192 ≤ ^{ }b^{3} + c^{3}≤ 292

This gives the following possibilities for b and c: 6 0, 0 6, 6 1, 16, 2 6, 6 2, 6 3, 3 6, 6 4, 4 6.

None of these give narcissistic numbers.

Next we consider 3 digit numbers of the form 3bc first. We need:

273 ≤ ^{ }b^{3} + c^{3}≤373

This gives the following possibilities for b and c: 6 4, 4 6, 6 5, 5 6, 7 1, 1 7, 7 2, 2 7, 7 3, 3 7, 7 0, 0 7.

Checking these we find 2 more narcissistic numbers:

370 = 3^{3}+ 7^{3} + 0^{3}

371= 3^{3}+ 7^{3} + 1^{3}

Using the same method, we can find that the only possibilities for 4bc are: 5 6, 6 5, 7 1, 1 7, 7 2, 2 7, 7 3, 3 7, 7 4, 4 7, 7 0, 0 7. Checking these gives us 1 more narcissistic number:

407= 4^{3}+ 0^{3} + 7^{3}

We can carry on with this method checking up to the form 9ab (it gets easier as there are less combinations possible, but will find no more narcissistic numbers. Therefore we have all the narcissistic numbers less than 1000:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407.

**Is there a limit to how many narcissistic numbers there are?**

Surprisingly there is a limit – there are exactly 88 narcissistic numbers in base 10. To see why we can consider the following:

In 3 digits the biggest number we can choose is 999. That would give 9^{3}+ 9^{3} + 9^{3} (or 3(9)^{3}). This needs to give a number in the hundreds (10^{2}) otherwise it would be impossible to achieve a narcissistic number. Therefore with an n digit number the largest number we can make is n(9)^{n} and if we can’t make a number in the 10^{n-1}, then a narcissistic number is not possible. If we can prove that the inequality:

n(9)^{n} < 10^{n-1}

is true for some values of n, then there will be an upper bound to the narcissistic numbers we can make. We could simply plot this directly, but let’s see if we can convince ourselves it’s true for some n without using graphical software first. Let’s see if we can find an equality:

n(9)^{n} = 10^{n-1}

First we take log base 10 of both sides

log n(9)^{n} = n-1

log(n) + nlog(9) = n-1

n(log9 -1) + logn +1 = 0

Next we make the substitution logn = u and therefore 10^{u} = n. This gives:

10^{u}(log9 -1) + u + 1 = 0.

Now we can clearly see that 10^{u} will grow much larger than u + 1, so any root must be for u is small. Let’s see, when u = 1 we get a positive number (as log9 -1 is a negative number close to 0), but when u = 2 we get a negative number. Therefore we have a root between u = 1 and u = 2. Given that we made the substitution logn = u, that means we have found the inequality n(9)^{n} < 10^{n-1} will hold for n somewhere between 10^{1} and 10 ^{2}.

Using Wolfram we can see that the equality is reached when u = 1.784, i.e when n = 10^{1.784} or approx 60.8. Therefore we can see that when we have more than 60 digit numbers, it is no longer possible to make narcissistic numbers.

**Quantum Mechanics – Statistical Universe**

Quantum mechanics is the name for the mathematics that can describe physical systems on extremely small scales. When we deal with the macroscopic – i.e scales that we experience in our everyday physical world, then Newtonian mechanics works just fine. However on the microscopic level of particles, Newtonian mechanics no longer works – hence the need for quantum mechanics.

Quantum mechanics is both very complicated and very weird – I’m going to try and give a very simplified (though not simple!) example of how *probabilities *are at the heart of quantum mechanics. Rather than speaking with certainty about the property of an object as we can in classical mechanics, we need to take about the probability that it holds such a property.

For example, one property of particles is *spin. *We can have create a particle with the property of either *up* spin or *down* spin. We can visualise this as an arrow pointing up or down:

We can then create an apparatus (say the slit below parallel to the z axis) which measures whether the particle is in either up state or down state. If the particle is in up spin then it will return a value of +1 and if it is in down spin then it will return a value of -1.

So far so normal. But here is where things get weird. If we then rotate the slit 90 degrees clockwise so that it is parallel to the x axis, we would expect from classical mechanics to get a reading of 0. i.e the “arrow” will not fit through the slit. However that is not what happens. Instead we will still get readings of -1 or +1. However if we run the experiment a large number of times we find that the mean average reading will indeed be 0!

What has happened is that the act of measuring the particle with the slit has changed the state of the particle. Say it was previously +1, i.e in *up* spin, by measuring it with the newly rotated slit we have forced the particle into a new state of either pointing right (*right* spin) or pointing left (*left* spin). Our rotated slit will then return a value of +1 if the particle is in right spin, and will return a value of -1 if the particle in in left spin.

In this case the probability that the apparatus will return a value of +1 is 50% and the probability that the apparatus will return a value of -1 is also 50%. Therefore when we run this experiment many times we get the average value of 0. Therefore classical mechanics is achieved as an probabilistic approximation of repeated particle interactions

We can look at a slightly more complicated example – say we don’t rotate the slit 90 degrees, but instead rotate it an arbitrary number of degrees from the z axis as pictured below:

Here the slit was initially parallel to the z axis in the x,y plane (i.e y=0), and has been rotated Θ degrees. So the question is what is the probability that our previously *up* spin particle will return a value of +1 when measured through this new slit?

The equations above give the probabilities of returning a +1 spin or a -1 spin depending on the angle of orientation. So in the case of a 90 degree orientation we have both P(+1) and P(-1) = 1/2 as we stated earlier. An orientation of 45 degrees would have P(+1) = 0.85 and P(-1) = 0.15. An orientation of 10 degrees would have P(+1) = 0.99 and P(-1) = 0.01.

The statistical average meanwhile is given by the above formula. If we rotate the slit by Θ degrees from the z axis in the x,z plane, then run the experiment many times, we will get a long term average of cosΘ. As we have seen before, when Θ = 90 this means we get an average value of 0. if Θ = 45 degrees we would get an average reading of √2/2.

This gives a very small snapshot into the ideas of quantum mechanics and the crucial role that probability plays in understanding quantum states. If you found that difficult, then don’t worry you’re in good company. As Richard Feynman the legendary physicist once said, “If you think you understand quantum mechanics, you don’t understand quantum mechanics.”

]]>**Modeling hours of daylight**

Desmos has a nice student activity (on teacher.desmos.com) modeling the number of hours of daylight in Florida versus Alaska – which both produce a nice sine curve when plotted on a graph. So let’s see if this relationship also holds between Phuket and Manchester.

First we can find the daylight hours from this site, making sure to convert the times given to decimals of hours.

**Phuket**

Phuket has the following distribution of hours of daylight (taking the reading from the first of each month and setting 1 as January)

**Manchester **

Manchester has much greater variation and is as follows:

Therefore when we plot them together (Phuket in green and Manchester in blue) we get the following 2 curves:

We can see that these very closely fit sine curves, indeed we can see that the following regression lines fit the curves very closely:

**Manchester:**

**Phuket:**

For Manchester I needed to set the value of b (see what happens if you don’t do this!) Because we are working with Sine graphs, the value of d will give the equation of the axis of symmetry of the graph, which will also be the average hours of daylight over the year. We can see therefore that even though there is a huge variation between the hours of daylight in the 2 places, they both get on average the same amount of daylight across the year (12.3 hours versus 12.1 hours).

**Further investigation:**

Does the relationship still hold when looking at hours of sunshine rather than daylight? How many years would we expect our model be accurate for? It’s possible to investigate the use of sine waves to model a large amount of natural phenomena such as tide heights and musical notes – so it’s also possible to investigate in this direction as well.

]]>