Why I bought a fax machine

Actually, I didn’t realise I had bought a fax machine until the laser printer I knew I had bought turned up and I read on the packaging that it was also a fax machine.

(Fax is perhaps the most disruptive technology I’ve seen rise and fall in my time as an adult – I last used one in 2005 as far as I can recall but only 15 years earlier they were seen as cutting edge – but no matter…)

Are printers like fax machines in another way too? Destined to all but disappear as the tyranny of the screen grows ever stronger? The reasons that motivated me to buy the laser printer (and not just another cheap inkjet that produces shoddy output and falls apart after a few months) make me think not.

• Paper is much more flexible than a screen – try scribbling a note on your screen and see how that goes.
• Paper is the ‘rest energy’ form – it’s true that printing a page takes a lot more energy than clicking on a HTML link, but paper is more or less the zero energy, zero technology form of reading something – it’s generally easier to do than reading something on a screen (and if you drop a page you don’t generally risk losing you ability to read either until you buy a new set of eyes).
• Paper’s flexibility makes it easier to see links – this is a killer application for paper in my field of software engineering (though maybe not all engineers would agree) – you can see much more information at once.
• Too many screens aren’t really very good for reading – too many screens on small devices just aren’t very good for reading text. When we print something we generally print it at a size that’s optimised for reading.
• Screens tire your eyes in the way that paper just doesn’t.

Getting a laser printer as opposed to an ink jet feels like a bit of an indulgence but as every other cheaper printer we’ve had over the years has generally fallen apart quickly I am hoping it is going to deliver long-term satisfaction.

Alexa, tell me what changed your mind

We were given an Echo Dot for Christmas. And it’s just brilliant.

I have to admit I was pretty cynical – my principal experience with Apple’s voice activated “Siri” is that it doesn’t understand my accent (even though you can select an Irish voice for the output, forget about it for the input.)

But this is really great. It sits in the kitchen and has essentially replaced the digital radio and the fact that you can ask it (simple) things is a bonus.

One of the best things about it is that it allows me to spend 10 – 15 minutes listening to “Morning Ireland” on RTÉ Radio 1 every morning as I eat my toast – easy access to that perspective on world events (and on what the only country with a land border with the UK thinks about what is happening here) is a great thing to have.

Cannot recommend it highly enough.

A puzzle from Donald Knuth

Recently I had to write some code to generate a pseudorandom number in a system with very limited sources of entropy. So, of course I turned to Donald Knuth and, in particular, Volume 2 – Seminumerical Algorithms – in the magisterial The Art of Computer Programming.

Reading through the questions/exercises I then came across this one:

Prove that the middle-square method using 2n-digit numbers to the base b has the following disadvantage: if the sequence includes any number whose most significant n digits are zero, the succeeding numbers will get smaller and smaller until zero occurs repeatedly.

(Knuth rates this question as ’14’ and, using his scale of difficulty which places a ’10’ as a minute to solve and a 20 as twenty minutes, probably means this should take about 7 or 8 minutes but I’ve spent much, much longer on it than that!)

A quick explanation: the middle-square method is a naive (though actually first suggested by none other than John von Neumann) random number generation method where we take a number n-digits long, square it and take the middle n-digits as our next seed or random number.

At first I thought I’d found an example where Knuth’s proposition appears to be false.

Let $b=10$ and the seed number be $N_0 =60$ then every subsequent number in the sequence is also 60 (obviously that’s as useless as repeated zeros for a random number generator.) But the problem with that is, that although it demonstrates a weakness in the middle square method, it doesn’t fit Knuth’s definition of the problem. What is $n$ here? If $n = 2, 2n=4, 4n=8$ ($n=2$ is the minimum for middle values), then $N_o = 0060$ and $N_0^2 = 00003600$ and so $N_1 = 0036, N_2=0012, N_3=0001, N_4=0$ (thanks to Hagen von Eitzen for clarifying this for me.)

So let’s look at the general case. (I also this explanation to Hagen von Eitzen, as compared to my very long-winded first attempt – though any errors that follow are mine not his.)

So we have a number $x$ which we think of as a $2n$ digit number – though the first $n$ digits are 0. Then $x^2 < b^{2n}$ (as the largest $x$ can be is $b^n -1$.)

Thus as the largest $x$ can be is $b^n - 1$ then:

$\frac{x^2}{b^n} \leqslant \frac{x(b^n - 1)}{b^n}$

And $\frac{x(b^n - 1)}{b^n} = x-\frac{x}{b^n}$

If we have a $2n$ digit number $x$ then the biggest number of digits we can get from the out put is $4n$, but in our case we only have $n$ digits to worry about so the biggest size $x^2$ can be is $2n$ digits, as again the leading $2n$ digits will be 0.

So, to apply the middle square method we need to lose the lower $n$ digits – i.e., take $\lfloor\frac{x^2}{b^n}\rfloor$.

From the above:

$\lfloor\frac{x^2}{b^n}\rfloor \leqslant \lfloor x-\frac{x}{b^n} \rfloor$

If $x > 0$ then $\lfloor x-\frac{x}{b^n}\rfloor$ will always $< x$, so the sequence decreases until $x = 0$.