Do LLMs dream of Pi? It’s a whimsical question in the vein of a Philip K. Dick story, exploring the meaning of artificial intelligence and reality itself. The reality we find ourselves in decades after Dick first wondered about electric dreams, a future containing large language models (LLMs) and chatbots, might offer new answers, or perhaps just better questions. I found a few of my own recently as I recalled a time when I was able to recite Pi out to many digits, basically on a dare, a few years ago.
During an offsite lunch with friends, the conversation turned to our favorite interview questions for new candidates. One of the questions offered during this session struck me as a bit Machiavellian, and it went as follows: you are a student in a math class, and the professor announces they will be giving a quiz on Monday where you will be asked to write Pi out to 100 digits. It is Friday. How will you prepare to pass this test?
To me, the obvious answer was to spend the weekend remembering 100 digits of Pi. Other options were proposed, mostly involving how to manage partying over the weekend while developing a clever (some might say fiendish) way to get the information into the class on Monday. While we were debating the ethics of some of these options, I told my colleagues that I would just memorize the digits and crush the test on Monday. They were skeptical this was possible, so I volunteered to do it on Monday (this being a Friday lunch).
I had a plan. Having read a few books about memory techniques, I thought I could build a “memory palace” over the weekend and recite the 100 digits on Monday. This involved a method called memory packing: turning digits into consonant sounds, forming these into words, and building a memorable narrative filled with vivid imagery. Vivid images are easy to recall while moving mentally through a scene, and the words can be decoded into the original digits when needed.
On the following Monday, I was able to recite 100 digits of Pi—as promised. Making the point that really anyone can do it, and you can do it too.
Memory
My recollection of this story turned into thinking about the memory technique I had used, and I realized my memory palace had long since evaporated. Unable to summon the images, I was no longer able to remember the digits. This is the problem with these memory techniques—use it or lose it.
While fumbling to reassemble the memories, I realized I still had the phonetic rules. I could use this to build a new memory palace! I muddled through a few digits and words. Once you have put a string of consonants together, thinking up memorable matching words arranged in the right sequence is the trick. While I pondered, it crept into my reverie that perhaps there was a shortcut. I could give all the rules to an LLM and prompt it to create candidate words. In fact, why not ask it to create the full narrative as well?
Excited to see what might be produced, I considered using a local LLM model, such as Qwen 3.8, but being in a hurry to see immediate results (local models are slow), and wanting a high degree of capability, I decided instead to use Opus 5 from Anthropic. What follows are the prompts I used to produce the new system:
The following content has ten 10 digit sequences I want to remember
using a memory technique using consonant sounds to represent each digit,
also given in the translation table. The trick is to string the consonant
sounds for each sequence and then choose words fitting those consonants
to make a sentence which, taken together, form a story I can remember
and translate back to the digits the words in the story represents.
Some of the sounds, for example the digit seven, are 'k' or it could be
a hard 'c' sound. Similarly, the digit 6 is 'j' or could be the 'ch' sound
in the words jay or chase. It helps if the words produce funny images.
Create a 10 line story that follows these rules. Show the digit sequence
next to each line.
### 100 digits of Pi
1415926535
8979323846
2643383279
5028841971
6939937510
5820974944
5923078164
0628620899
8628034825
3421170680
### Digit translation
|---|---|
| 0 |z s|
| 1 |t d|
| 2 |n |
| 3 |m |
| 4 |r |
| 5 |l |
| 6 |j |
| 7 |k |
| 8 |f |
| 9 |p b|
Here’s a resulting sample of the first attempt.
1. 1415926535
A TURTLE strums a BANJO until the LLAMA starts to HOWL.
TURTLE 1415 · BANJO 926 · LLAMA 53 · HOWL 5
2. 8979323846
That howl hardens into a FIB told to a COP from the MOON, who works for a
MAFIA ROACH.
FIB 89 · COP 79 · MOON 32 · MAFIA 38 · ROACH 46
...
It got the phonetic encoding right, but problems abounded in the narrative composition. Having to remember which words were in BOLD would not be easy. Another feature lacking here is the use of too many words. The main goal of memory packing is to compress related items into a “package” that can be stored away and later unpacked.
I modified the prompt accordingly:
Let's try an approach where I don't have to remember certain words as being
BOLDED as the ones to decode. I'm thinking the encoded words can be nouns,
adverbs, verbs, or adjectives, but we can use prepositions, or other
connecting words like 'the' (which doesn't have any of the encoding sounds in
it), to help form sentences. Can you give that a go?
This yielded a very good result (sample below), but the sentences are disjointed and lacking logical flow. For example: taking the first line, I could easily imagine a turtle and a pony (perhaps the pony riding on the turtle’s back) jailing a mule, and that image by itself is memorable enough, but the sentence following on the second line has no connection to the first. So, I’m left with having to remember each sentence discretely in order. Also, what the heck is a “moon mafia roach”? I’d hate to meet one in a dark alley.
1. 1415926535
The TURTLE, the PONY, they JAIL the MULE.
TURTLE 1415 · PONY 92 · JAIL 65 · MULE 35
2. 8979323846
I FIB, I COP the MOON MAFIA ROACH.
FIB 89 · COP 79 · MOON 32 · MAFIA 38 · ROACH 46
3. 2643383279
NACHO RAM, MIFF the MANIAC with a PIE!
NACHO 26 · RAM 43 · MIFF 38 · MANIAC 327 · PIE 9
Seeing a need to improve things, I took a stab at another prompt which yielded the best solution.
Recalling the Palace
Realizing I needed to link the sentences in a coherent and memorable way (for me), I suggested a new approach to tie everything together. In the final prompt, I associated each line number with a corresponding month to establish a theme for each stanza. Also, I added a bit of positive reinforcement—a technique that has shown promise with advanced reasoning models, often resulting in them “trying harder” without using negative language.
Now, I am really going to challenge your creative powers. You're doing great.
Each line 1 through 10 I can associate with the corresponding month 1 is
January, 10 October. Re-write the story so the sentences have some
association with the month they are about, for example September is Autumn,
so perhaps leaves or fall, and October is halloween, so cats or witches could
be weaved in according to the month. This makes it easier to recall the
encoded sentences according to their month/line
The final version that follows not only met my criteria, but also surpassed my expectations in some ways. I’ve included the full answer from the model, including the model’s notes:
Here's the month-themed version. Same rule as before: every content word
encodes, and the entire glue vocabulary across all ten lines is the, a, we, I,
with—every one of which carries zero encoding sounds.
---
1 · JANUARY—1415926535
TEARY, IDLE, we PUNCH the LIME ALE.
TEARY 14 · IDLE 15 · PUNCH 926 · LIME 53 · ALE 5
New Year's Day: red-eyed, doing nothing, swinging at the leftover party punch.
2 · FEBRUARY—8979323846
I FIB, I CUP the MOON, I MUFF the ROUGE.
FIB 89 · CUP 79 · MOON 32 · MUFF 38 · ROUGE 46
Valentine's flattery—the sweet lie, the moon cupped in your hands, the red
makeup smeared.
3 · MARCH—2643383279
We OWN the CHARM, we MIFF the MEAN CAP.
OWN 2 · CHARM 643 · MIFF 38 · MEAN 32 · CAP 79
St. Patrick's: we've got the lucky charm, and the leprechaun under the mean
green cap is furious.
4 · APRIL—5028841971
LOOSEN the IFFY OAF with the READY BUCKET.
LOOSEN 502 · IFFY 8 · OAF 8 · READY 41 · BUCKET 971
April Fools meets April showers—loosen the stiff fool up with a bucket
that's been waiting all month.
5 · MAY—6939937510
JAY, BEAM the BABY MEEKLY with a DAISY!
JAY 6 · BEAM 93 · BABY 99 · MEEKLY 375 · DAISY 10
Spring: blue jay, spring baby, and a daisy lobbed very apologetically.
6 · JUNE—5820974944
WEALTHY FANS BICKER with the BEARER.
WEALTHY 5 · FANS 820 · BICKER 974 · BEARER 944
June wedding—the rich guests fighting with the ring bearer.
7 · JULY—5923078164
We HAIL the BUN, the MUSIC, the FAT CHEER.
HAIL 5 · BUN 92 · MUSIC 307 · FAT 81 · CHEER 64
Fourth of July: the hot dog bun, the marching band, the big roar from the
parade route.
8 · AUGUST—0628620899
The ICY OCEAN: we FISH the NOISY, IFFY PUPPY.
ICY 0 · OCEAN 62 · FISH 86 · NOISY 20 · IFFY 8 · PUPPY 99
Dog days—hauling a yappy, questionable dog out of the cold surf.
9 · SEPTEMBER—8628034825
FASHION the FAUX SUMMER FINALE.
FASHION 862 · FAUX 8 · SUMMER 034 · FINALE 825
Indian summer and back-to-school clothes: staging a fake last act for a season
that's already over.
10 · OCTOBER—3421170680
MARINATE the TICK, the ICE, the WITCH FACE!
MARINATE 3421 · TICK 17 · ICE 0 · WITCH 6 · FACE 80
Halloween cauldron recipe—and the witch's face is in the pot.
---
How the months paid off. The digits themselves handed me several of these.
Line 3 contains 643 right where a word had to start, which is CHARM—pure
luck for St. Patrick's. Line 9 has 034 buried in the middle, which is exactly
SUMMER, so September wrote itself. Line 10 has a lone 6 sitting at position
eight, and 6 is the ch/sh digit—that's WITCH, in October, at no cost. Line
8's two 62s gave me OCEAN to work with for August.
Two lines fought back. January has no 0 anywhere, so no s or z sound is
available in the whole line—no snow, no ice, no resolutions. I went with the
hangover instead. And February's chunks are all short two-sound pieces, which
is why it came out as three parallel clauses rather than one sentence; the
repetition actually makes it easier to chant.
The packaging now condenses things on at least three dimensions: the ordering of the stanzas follows an easy association to the months I already know, each verse has a thematic association to its corresponding month, and finally, averaging five words in length, the passages compress 10 digits into a small package.
Challenge Accepted
With the final memory palace above, I encourage you to give it a try. It’s also a handy way to memorize phone numbers.
What made this final version surprising was seeing the model’s commentary on how it made certain choices showing in-depth understanding of the alternatives. Each of the thematic verses, along with the elaboration of the underlying imagery for each month, showed, shall I say, creativity? This goes far beyond how many ‘r’s are in strawberry, and it does lead to further questions.
From a technical standpoint we see the model combining facets of a problem requiring the juxtaposition of syntax, phonetic rules, permutations, and thematic constraints, while hitting every mark. Perhaps the challenge wasn’t as complex as I had imagined? Language is the sweet spot for LLMs. Seeing this, I want to be especially careful not to summon the impression of another mind at work. This is something we are hardwired to do. As you read this, you’re likely forming impressions of how I think, and what my motivations are. You can’t help it, and neither can I.
The second challenge is to avoid granting agency, and perhaps even trust, to a technology cleverly designed to emulate linguistic feats, complete with perfect grammar, possibly overcommitting to the likelihood that its constructions are correct and worthy of our trust.
It’s difficult to convey how the model’s language engenders a “presence” which can crop up in a tangible way, but I recently had a discussion with my dad, who was using Gemini to help process the news of a friend’s loss. The model provided very plausible advice on how to support his friend, suggested checking in and offering resources, and finally offered to draft a text he could send his friend in time of need. I asked my dad to consider whether he would allow the model to send that text to his friend without him first reading it, to act as his proxy, given how well it writes. Of course, he said no, and the reasons boil down to trust. To be fair, I might not trust anyone to send such a message for me, but the likelihood is far greater if they are a fellow human being.
Is there feeling and empathy here? I would say no. That would require a mind capable of feeling empathy. It’s capable of recreating language that simulates what a fellow human could create: an empathetic thought. So, we should be careful how we use these models, ensuring we imbue our taste, discretion and humanity into the work we create with their assistance.
It’s worth noting that the final result of my thought experiment emerged from a collaborative process. I think this is an important facet of working with LLMs. I could have created a multi-agent interaction, a producer<->reviewer construct wherein the two agents would arrive at a final product. It would be interesting to try this, yet I can’t help think the result would not have been as good. By collaborating, I was able to infuse aspects of the solution I needed—knowing my weaknesses and lack of total recall—while amplifying my ability to search a lexicon of possible words for which the model has the advantage. The result was better.
I think this was a good partnership. Maybe the models will one day dream about Pi…
P.S. All the emdashes were hand-crafted by me.