Using your Head is Permitted

July 2010 solution

The main repeating theme in Martin Gardner's work is that math is -- and should be -- fun, and it seems to me that solvers this month all worked in this spirit. Certainly, I had lots of fun receiving this month's solutions.

First, I promised a solution using only the digits of the year. In fact, I will show that it is possible to calculate Gardner's age using only a single zero digit.

Martin Gardner died on the 22nd of May 2010, aged just over 95 and a half. In order to calculate 95 from a "0" using only the addition of ASCII symbols consider the following expression


where x is an integer and "~" stands for bit-wise negation. The expression above translates to x+1. (You're welcomed to try. The expression, as written here, is perfectly legal Python code.) By repeating this incrementation, any integer can be produced even from a single zero. For example:


If we want to use the digits of the year "2010" to reach 95 this can be done using the trick above fairly elegantly as


where "<<" is left shift and "!" is a factorial operation. This calculation also preserves the original digit order of the year.

When using both the year and the month such dirty tricks are not needed. The most popular solution to this month's riddle was


which also preserves the digit order. The first solver to suggest this solution was Albert Stadler.

Bojan Bašić sent the following innovative solution

(((5 - 2)!)!!)*(0! + 1) - 0!

also preserving the digit order. Here "!!" stands for the "double factorial" function.

However, this would not have been a "Martin Gardner-style" riddle had there not been a subtle trick. In this case, the trick was that the digits of the month and year in the date "22/05/2010" are "052010", and there is no reason not to utilize the leading zero in the notation of the month. Most solvers did, indeed, take advantage of this leading zero. Here are two examples:

From Robert DiMarco:


and from Jan Herout:


Yoav Yaari sent in a spectacularly original solution:


In a normal month I would have most likely rejected this solution, but if the point this month was to have fun and celebrate the tradition left to us by Martin Gardner, then I think this solution is the most fun of the lot...

The most commonly sent of the solutions utilizing the leading zero were




Lastly, here's one solution from me that, surprisingly, nobody sent in:

((0!+0!+0!)<<5)-1/2 = 95.5

giving a more accurate age (while still, as required, rounding down).

As for the bonus question:

The equation we mean to solve is n(n-1)=2m(m-1).

Let x=2n-1, y=2m-1, then 2y2-x2=1.

Note that not only does each <n,m> solution translate uniquely to an <x,y> solution, the opposite is also true: any <x,y> solution is also an <n,m> solution because x and y can easily be shown to be odd. (Just look at the equation modulo 4.)

The equation 2y2-x2=1 is a special case of a Pell equation, named so after the English mathematician John Pell (who, curiously, never studied it). It was first used by the Pythagoreans to calculate rational approximations for √2.

Much of the theory surrounding Pell equations has to do with how to find the minimal solution for each equation. In our case, after the trivial solution x=1, y=1 (corresponding to n=m=0), the first nontrivial solution is x=7, y=5, corresponding to n=4, m=3. This is the most reasonable solution if the family is assumed to be human: the next solution involves an impressive 21 siblings.

Once the first solution is found, it is relatively straightforward to create from it an infinite number of solutions via a technique similar to the one used in the September 2009 riddle. Namely, if <x,y> is a solution then <3x+4y,2x+3y> is also a solution. (I leave as a simple exercise for the reader how the minimal solution can be used to construct this formula.)

To prove that the solutions generated from the trivial <1,1> solution are the only solutions, simply invoke the formula in reverse: from any <x,y> solution, a smaller solution is <3x-4y,-2x+3y>. If there is any solution to the equation other than those generated by the <1,1> trivial solution, at least one of them must be between <1,1> and the first solution generated by it, <7,5>. However, we already verified that <7,5> is the minimal nontrivial solution (and, in fact, we constructed the recursive formula in light of this).

Finding the ratio between consecutive solutions for n (and also for x) is now easy: y tends towards x*√2/2, so 3x+4y tends to (3+2√2)x, meaning that the ratio is 3+2√2.

Finding the full formula for the i'th solution is a bit more involved and requires eigenvalue analysis of the generating matrix

3 4

2 3

analogously to what is done in finding an explicit formula for the Fibonacci sequence. The solution turns out to be

xi = (3+2√2)i(1+√2)/2 + (3-2√2)i(1-√2)/2

yi = (3+2√2)i(2+√2)/4 + (3-2√2)i(2-√2)/4

ni = (3+2√2)i(1+√2)/4 + (3-2√2)i(1-√2)/4 + 0.5

mi = (3+2√2)i(2+√2)/8 + (3-2√2)i(2-√2)/8 + 0.5

Readers are welcomed to check that this, indeed, works.

Back to riddle

Back to main page