The wonderful world of numbers
Alex Elmsley’s Octave Pencil Trick — When the Question Reveals the Answer
I stumbled upon Alex Elmsley’s Octave Pencil Trick in the most unexpected place — while listening to The Rest Is Science podcast episode: “The Magic Math Trick That Fools Everyone.”
I was at the gym, only half listening between sets, but one idea instantly grabbed my attention. A magic trick where the spectator unknowingly tells you the answer while asking the question.
That was enough. Curiosity activated.
I went down the internet rabbit hole, found references to Alex Elmsley’s classic effect, and within hours I had built my own version using nothing more than a pencil and a marker.
And honestly, that’s the beautiful part of this trick.
The magician doesn’t really “know” the answer beforehand in the mystical sense.
The structure of the question itself carries the information needed to determine the answer.
The spectator reveals the secret without realizing it.
That idea fascinated me far more than the trick itself.
First Experiments
Once I built a replica, I immediately started testing it on family and friends. By Christmas, it had become my favorite mini-performance piece.
I had an absolute blast fooling kids and adults alike at our Christmas party:
Everyone reacts the same way:
“Wait… how did you know that?”
But after the initial fun wore off, my engineering brain kicked in.
I started asking different questions:
- How did Alex Elmsley come up with this?
- What mathematical structure makes this work?
- What are the limitations?
- Can the idea be generalized?
- Could I create my own version?
That’s where things became really interesting.
The Hidden Mathematics
At first glance, the trick appears magical because it feels impossible for the performer to know a hidden number.
But underneath, it’s really a clever encoding system.
The trick operates on a two-digit number where one digit influences the other through a constrained relationship. The questions asked to the participant are carefully designed so that their responses leak enough information to reconstruct the hidden value.
In other words:
The spectator believes they are hiding information, but mathematically they are narrowing the possibilities for you.
This is what makes the trick elegant.
Not complicated mathematics.
Not brute-force memorization.
Just beautifully designed constraints.
Why This Fascinates Me
What I love most about mathematical magic is that the method often feels inevitable after you understand it.
You look back and think:
“Of course that works.”
But before you see the structure, it feels impossible.
That transition — from mystery to understanding — is deeply satisfying.
Alex Elmsley was brilliant at creating effects where the method is almost invisible because it hides inside normal conversation and natural assumptions.
The Octave Pencil Trick is a perfect example.
The audience thinks the magic is in the answer.
The real magic is in the question.
Beyond the Original Trick
Naturally, I couldn’t stop at simply performing it.
I started exploring:
- alternate numbering systems,
- different constraints,
- whether the same principle could work with three digits,
- and how much information can be extracted from seemingly innocent questions.
Once you start looking at it this way, you realize these tricks are really small lessons in:
- information theory,
- encoding,
- deduction,
- and human perception.
Magic and mathematics overlap far more than most people realize.
And sometimes, all it takes is a podcast playing in the background at the gym to rediscover that.

