You're reading: Irregulars, Uncategorized

Fibonacci and a Feat of Memory

This is a guest post by Chris Taylor.

I recently read “The Warlock Effect” by Jeremy Dyson and Andy Nyman (read it – it’s good). It’s a work of fiction about a stage magician who uses his skills to combat a threat to UK national security – not somewhere you expect to find to find an interesting mathematical question.

One chapter describes how to perform an apparently astounding feat of memory. (The chapter is a kind of interlude between the ongoing action in the book, so what follows is not a plot spoiler.)

As the person performing the memory feat you have a number of cards, which you hand out to your audience. Each card has a 1 or 2 digit identifier on one side and a 10 digit number on the other. For example card number 12 has 3257291011 on the back. Card 26 has 7303369549.

You claim to have memorised the number on every card. You invite your audience to choose a card and then tell you the card number. You then reel off the 10 digit number. The trick is more impressive if you have a lot of cards – say 50.


How does this trick work? And it is a trick – you don’t need to memorise the numbers. Perhaps you should stop reading this article for a while and try to work out what’s happening. To help (or further confuse), here are a few more card details. It’s probably better to concentrate on the 10 digit numbers rather than trying to relate them to the card ID.

Card IDNumber
12134718976
56178538190
90224606628
201347189763
390550550550

How it works

The character describing the trick is not the hero of the book. In fact he doesn’t appear anywhere except for this one chapter. He is a compulsive liar and the authors have named him “Fibbin’ Archie”. To my shame, this rather heavy hint went right over my head. My excuse is I was reading just before going to sleep and I hadn’t set my maths alarm.

Each 10 digit number is a kind of Fibonacci sequence – a Fibonacci sequence Mod 10. The first 2 digits define the series. Each digit is the sum of the previous two, and if the sum is greater than 10, only the unit part is used. For example, card number 1 starts 21.

2+1 = 3, 1+3 =4, 3+4 = 7, 4+7 = (1)1, and so on.

The series builds: 21, 213, 2134, 21347, 213471, 2134718, 21347189, 213471897, 2134718976.

So if you know the first 2 digits you can easily construct your 10 digit number.

How do you know what the first 2 digits are? There’s a bit of disguise here. Take the card ID (say 1), add 11 (to give 12) and reverse the digits (to give 21). And that’s it. A trick guaranteed to baffle an audience that doesn’t really have the time to work out what’s going on. If you intend to perform this trick it’s probably best if you exclude some card IDs. For example 39 yields 0550550550. Also note that card 20 produces a sequence just one digit along from card 1.

If you had a card ID of zero the sequence would be 1123583145, and I think even I might have spotted that. In fact adding 11 to the card ID neatly avoids the sequences that start 01 and 11, reducing the chances of your trick being revealed by a mathematician lurking in the audience.

What’s going on?

When I read this I was fascinated. Not just by the trick but by what is going on with the number sequences. Clearly there are 100 possible starting points, from 00 to 99, giving 100 different sequences. But suppose you continue the sequence beyond 10 digits. You can go on adding digits indefinitely, but you must eventually reach a digit pair that you have encountered before, since there are only 100 possible pairs. At this point the sequence will start to repeat and form a loop.

Will there be just one big loop, with all 100 pairs? Are there several different loops? Can the loops intersect or have branches? My interest was piqued and I had to investigate.

You could just do this by brute force and write out all the possible sequences – but you can answer some of the questions without doing that. Suppose you start with 2 odd digits, say 11. The next digit must be even (E) – in this case 2. The one after that is even + odd, giving odd (O), so the sequence goes 112358… which gives the pattern OOEOOEOOE…

If you start with OE or EO, you end up in the same pattern, since these combinations are part of the sequence. This means you can’t get pairs with 2 even digits unless you start with 2 even digits. And in this case you only get even digits in the sequence.

There are 25 pairs with both digits even, so the longest possible sequence would be if all the odd and odd/even pairs were in a single 75 digit sequence, and there must be at least one more sequence with 25 or fewer pairs.

It turns out that there are 3 odd-even sequences, each a complete loop with no branches. I would like to be able to say that I adopted a mathematically rigorous approach to finding these sequences, but I didn’t. I started with 12 and immediately hit on the longest sequence. What are the chances of that? (About 80%, I think). I did, though, realise that the process can be worked backwards. For example the digit before 12 must be a 1, and the one before that must be a zero. This means that the digit before and after each pair is uniquely defined, so the sequences don’t have branches.

  • There is a sequence starting with 12 which is 123583145943707741561785381909987527965167303369549325729101 12
    This has 60 digits and is what we think of as the Fibonacci series.
  • A second sequence is 134718976392 1347….. (12 digits)
  • A third is 055 055… (3 digit pairs: 05, 55, 50)

There are 3 all even sequences:

  • 24606628088640448202 24…. (20 digits)
  • 2684 2684… (4 digits)
  • 0000… (1 digit)

Some observations:

  • the odd/even sequences are 3 times longer than the even ones
  • if you multiply each digit in an odd/even sequences by 2mod10, you get an even sequence repeated 3 times
  • the second sequence in both cases contains no zeroes
  • if you split a sequence in half, for example 134718 976392, each digit in the second half is 10 minus the corresponding digit in the first half
  • a string of zeroes is technically a Fibonacci sequence. Who would have thought that?

Other thoughts

I looked at sequences produced by using other bases. For example using mod 8, you get 4 sequences of 12 digits, 2 of 6 digits, 1 of 3 digits and the 00… that is produced in any base. Using mod 11 gives 11 sequences of 10 digits, 2 of 5 digits and 00…

With any even number base, there is always a sequence that goes 0XX 0XX, where X = base/2.

Of course, I could have saved myself a lot of time and trouble by simply googling the topic. I would have learnt about Pisano periods and the work of Lagrange. But where’s the fun in that?

There’s a very good video by James Grime on the Numberphile channel (from 2013). He explains this much better than I do – but he doesn’t show you a magic trick.

About the author

  • Chris Taylor

    I'm retired from work, but not from life. I worked as a physicist in the electricity industry and then the NHS.

2 Responses to “Fibonacci and a Feat of Memory”

  1. Avatar Andy

    Card 9, as you’ve specified, doesn’t follow the rule. 9 + 11 = 20, and reversing the digits would give 0-2 as the starting pair of digits, not 2-0.

    Reply
    • Chris Taylor Chris Taylor

      Hi Andy
      You are quite right. I have amended the post. In fact the change moves the sequence along by exactly 1 digit

      Reply

(will not be published)

LATEX: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>