The Graph That Makes Divisibility by 7 Obvious
Turning modular arithmetic into a simple walk.

The Graph That Makes Divisibility by 7 Obvious
Turning modular arithmetic into a simple walk.
Read it here if you’re not a Medium member. If this helped you see mathematics differently, support my writing ☕ here
Divisibility rules seem to be a shortcut in most cases.
If it comes to 3 and 9, you sum digits. If it’s about 11, you use alternating sums. In case of 8, you only check the last three digits.
Then comes 7.
It will no longer be an elegant rule but an algorithm : you multiply the last digit by two, subtract it from the rest, do the same until you get small enough numbers. The algorithm surely does work, but it does not explain anything just like following a cooking recipe rather than math.
The beauty of the graph above lies in its transformation of the algorithm into a picture.
Rather than transforming a number over and over again, one goes around a circle of seven points. Each step is a mathematical operation, and by the time when you are done with your walking through digits, you unconsciously did the same calculation as long division.
When you figure out how the above graph works, divisibility by 7 no longer looks like a tricky thing.
Cracking the Problem ➡️
When you first see the graph it will appear rather puzzling.

There are seven positions arranged like a clock. One is labeled YES, representing remainder 0. The remaining six positions represent remainders 1 through 6.
Two different kinds of arrows connect these states.
The white arrows simply move clockwise around the circle.
The green arrows jump to another location entirely.
Following the instructions is surprisingly simple.
Start at YES.
Read the number from left to right.
For each digit :
⦿ move forward that many white arrows,
⦿ then follow exactly one green arrow,
except after the final digit, where you stop immediately after the white movement.
If you finish on YES, the original number is divisible by 7.
Otherwise, the position where you stop is exactly the remainder after division by 7.
Nothing is being approximated.
Nothing is being guessed.
The graph computes the exact remainder.
Let’s see the process in action.
Take the number 213.
Begin at YES.
The first digit is 2.
Move two white arrows.
You arrive at remainder 2.
Now follow the green arrow.
You jump to 6.
The next digit is 1.
Move one white arrow.
From 6, one step returns to YES.
Follow the green arrow.
So you remain at YES.
Now read the final digit, 3.
Move three white arrows.
You finish on remainder 3.
Not on YES.
Indeed,


The graph reports exactly the correct remainder.
The natural question is why this strange walk should have anything to do with divisibility.
The answer lies in something we usually ignore when reading numbers : place value.
Suppose you’ve already read some digits.



It shifts every previous digit one decimal place to the left.



This single equation explains the entire graph.
The graph merely separates the computation into two independent actions.

which is exactly what the white arrows accomplish.

which is exactly what every green arrow represents.
Instead of performing algebra after every digit, you simply follow arrows.
The graph isn’t replacing modular arithmetic.
It is modular arithmetic.
Once you recognize this, the green arrows stop looking arbitrary.
Take remainder 1.
Multiplying by 3 gives 3.
So the green arrow from 1 goes directly to 3.
Now multiply again.

Continue :

Every nonzero remainder appears exactly once before returning to the start.
Why ?
Because 3 and 7 are relatively prime.
Multiplication by 3 merely permutes the possible remainders.
Every state has one outgoing green arrow and one incoming green arrow.
Nothing is lost.
Nothing is duplicated.
The graph is completely reversible.
That elegant cycle is the reason the construction works so cleanly.
Now consider 1365.
Start at YES.
Digit 1 moves you to remainder 1.
The green arrow sends you to 3.
Digit 3 advances three positions to remainder 6.
The green arrow sends 6 to 4.
Digit 6 advances six positions from 4 to remainder 3.
The green arrow sends 3 to 2.
Finally, digit 5 advances five positions.
You land exactly back on YES.
Therefore, 1365 is divisible by 7.
Indeed,

Again, the graph gives the exact answer without ever performing long division.
One detail often surprises people.
What happens when a digit is larger than six ?
Nothing special.
Suppose the digit is 8.
Moving eight white arrows is identical to moving one white arrow after completing one full revolution around the circle.

both movements end at the same location.
The graph naturally handles every decimal digit because only remainders matter.
It’s exactly the same principle that lets a clock ignore whether you add three hours or fifteen hours.
After one complete cycle, you’re back where you started.
From another angle, the figure above represents a small computer.
It has seven locations, which are called states.
Each input digit moves the computer from one state to another based on a predetermined formula.
After all input digits have been considered, the final state holds the remainder.
Computer engineers refer to such systems as finite-state automatons.
These devices can be found anywhere.
The parsers of computer languages use finite-state automatons.
Finite-state automatons update states continuously as input bits come in.
Communication protocol hardware uses the exact same principle to validate data streams.
Even the hardware that implements divisibility testing uses finite-state automatons astonishingly similar to the graph above.
A seemingly simple puzzle embodies the very structure that is at the heart of computer engineering.
This larger perspective is what gives the entire diagram its satisfaction.
The graph doesn’t just provide yet another divisibility trick.
It shows us the underlying method at work in decimal computation itself.
Each digit changes a state.
Each place value scales the previous one.
Every remainder evolves according to one simple recurrence,

The arrows simply visualize that evolution.
Once you stop thinking of divisibility as a movement through a set of states, as opposed to subtracting again and again or following rules learned by rote, there is no going back.
The “ trick ” evaporates.
All that remains is a much more profound understanding of long division, modular arithmetic, automata theory, and place value as simply facets of the same concept.

I completed my 100 Days of Mathematics Challenge!
Thank you to everyone who supported and encouraged me throughout this journey.
📖 DAY 11 article ➜
Thank you for reading! 😊
If you enjoyed this puzzle, please consider following me for more mathematics content, subscribing to stay updated with my latest articles, and leaving a few claps it really helps! 👏
Have a question, a different solution, or an interesting insight ? 💬 Share it in the comments below. I’d love to hear from you! 🤗

메타데이터
- post_id
- 56df868e97b5
- slug
- the-graph-that-makes-divisibility-by-7-obvious-56df868e97b5
- url
- https://medium.com/think-art/the-graph-that-makes-divisibility-by-7-obvious-56df868e97b5
- canonical_url
- https://medium.com/think-art/the-graph-that-makes-divisibility-by-7-obvious-56df868e97b5
- author_url
- https://medium.com/@thanushansiva100
- status
- ok
- fetched_at
- 2026-07-10 19:15:58