Why AI Fails at Simple Math and Counting Letters: How Tokens Work (and How to Fix Your Prompts)
AI can write complex code in seconds, yet miscounts letters in a single word or gets basic decimals wrong. Learn how tokenization causes this and how to prompt cleanly.
How Can AI Write Working Code Yet Miscount Letters in 'Strawberry'?
Language models do not see individual letters or digits—they read compressed chunks called tokens.
It confuses almost every student and developer the first time it happens: an AI explains quantum mechanics effortlessly, then confidently claims 9.11 is larger than 9.9 or miscounts the letters in an everyday word. The culprit is tokenization. Before a model ever sees your prompt, a tokenizer slices words and numbers into uneven chunks mapped to numeric IDs—meaning the model is guessing character details from whole-chunk patterns unless you force step-by-step breakdowns.
4 Prompt Rules for Far More Reliable Math and Logic
# How humans see a word vs. how an AI tokenizer splits it:
Human: s - t - r - a - w - b - e - r - r - y (10 letters)
Tokens: ["str", "aw", "berry"] (3 numeric IDs!)
# Better prompt structure for math & logic:
1. List every given variable on its own line.
2. Solve step by step using explicit equations.
3. Verify the final arithmetic by substituting back.Keep Your Math Steps Clean in a Real Notebook—Not Buried in Chat
Clear step-by-step notation exposes arithmetic slips in one second.
Drafting equations cleanly with Tekno Notebook's live LaTeX support—and refining your logic templates inside its built-in AI prompt debugger—keeps you in control of every calculation with an offline archive ready for exam day.
AI excels at explaining concepts and outlining approaches, but reliable math always starts with clear, visible steps.