1729 = 2 Cubes 2 Ways

Ramanujan’s 129th Birthday

22nd December 2016

Someone on Reddit pointed out that today (Dec 22nd) is Ramanujan’s 129th birthday. One of the commenters further pointed out that 129 is the sum of the first 10 primes, and the smallest number that is the sum of three squares in four different ways (echoing Ramanujan’s comment on G.H. Hardy’s taxi number 1729 being the smallest […]

Matrix Rain

Have we already seen this number? (deja vu again)

8th April 2016

I had a phone interview for a Python job the other day. It started out really well, he was very impressed with my CV and called me a ‘rocket scientist’. But then we got down to the technical questions and my brain decided to go out to lunch, and (yet again) I managed to snatch defeat […]

Guess my number?

Number guessing game

1st October 2015

The number guessing game incorporates several simple but important elements of elementary programming and is a good candidate for an introductory programming example. If you’ve seen any programming course, you’ve probably seen the “Hello World” program. In Python it’s: print (“Hello World”)This is done to get the student(s) quickly to the point of having successfully installed […]

Pi by J.Gabás Esteban

Playing in Python with Pickover’s Premise per Pi

1st June 2015

My favourite tweeter is Clifford A. Pickover. His tweets are delightful nuggets of math, physics & more. I have a copy of his fascinating The Physics Book. However, in these tweets, he claims that the string 44899 first occurs in pi at position 44899, counting from the first digit after the decimal point. I thought it might be […]

Jengod at the English language Wikipedia [CC BY 2.5 (http://creativecommons.org/licenses/by/2.5), GFDL (www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)], via Wikimedia Commons

Compute Average Heights

3rd May 2015

This is a simple program to compute average heights. In a loop, it prompts the user for heights, inputs a text string and converts it to a ‘real’ number, sums them, and divides by the number of heights. Exit is signalled by negative height, after which the sum of the numbers is divided by the number of […]

Binary Search

27th April 2015

Binary Search is one of the most fundamental computer algorithms. Given an ordered list of some data (names, numbers, …) find out if it contains a particular item. For example, consider the list: 2, 4, 5, 7, 8, 11, 12. If we ask if it contains the number 5, the algorithm should return 2 (counting […]


16th April 2015

This is apparently a well-known interview question (but not one I was ever asked). Print the numbers 1 to 100, but replace every number divisible by 3 with “Fizz”, every number divisible by 5 with “Buzz”, and every number that’s divisible by both 3 & 5 with “FizzBuzz”. Apparently many people have difficulty with it. […]