The Math Behind FLAMES and the Josephus Problem
FLAMES looks like pure schoolyard play: cross out some letters, count around a word, and read the verdict. Underneath, the second half is a tidy piece of mathematics. Counting around a circle and removing every so-many-th item is the structure of a well-known puzzle called the Josephus problem.
This article explains that connection, shows a shortcut that finds the winner without crossing anything out, and proves two facts about the game: the results repeat every 60 counts, and over those 60 counts each letter wins exactly ten times. You only need division with remainders. None of it makes the game a predictor of anything; it just shows how the machine works.
Two Machines in One Game
FLAMES has two separate stages.
- Letter canceling. Ignoring case, spaces, and punctuation, you cross out shared letters one for one. The letters left in both names are added up to give a number, which we will call n.
- Circular elimination. Starting at F, you count n places around F, L, A, M, E, S, remove the letter you land on, and begin again at the next letter. You continue until one remains.
The first stage is the only place the names matter. The second stage sees nothing but n. Two very different pairs of names with the same n are identical as far as the elimination is concerned.
The Josephus Problem in Plain Terms
Picture some number of items arranged in a circle. Pick a step size. Count that many items, remove the one you land on, and carry on from the following item. Which item is left at the end?
That is the Josephus problem. FLAMES is the case with six items, where the step size is n. One difference in emphasis: textbook treatments often fix a small step and let the circle grow. FLAMES does the opposite, fixing the circle at six and letting the step vary with the names.
Remainders: The Key Tool
Counting around a circle of six wraps back to the start after every sixth step. So counting 7 places lands on the same letter as counting 1 place, and counting 15 lands where 3 does.
We write "a mod b" for the remainder when a is divided by b. For example, 15 mod 6 is 3, and 12 mod 6 is 0.
Number the positions from 0 so the remainders fit neatly:
| Position | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Letter | F | L | A | M | E | S |
Starting at position 0 and counting n places, where the starting letter counts as one, lands on position (n − 1) mod 6. That is the first letter removed.
A Full Elimination, Step by Step
Take n = 7, which is what Sophia and Ethan produce: H and A cancel, leaving S, O, P, I and E, T, N.
| Circle, starting where the count begins | Count 7 lands on |
|---|---|
| F L A M E S | F (removed) |
| L A M E S | A (removed) |
| M E S L | S (removed) |
| L M E | L (removed) |
| M E | M (removed) |
E is left, so the result is Enemies. Notice that each row is rewritten to begin at the letter after the one just removed. That rewriting is the idea behind the shortcut.
The Shortcut: Work Backward From One Letter
Instead of removing letters from a big circle, we can build the answer up from a tiny one. Let J(m) be the position of the survivor in a circle of m items, numbered from 0, with step n.
- With one item, it survives: J(1) = 0.
- For larger circles: J(m) = (J(m − 1) + n) mod m.
Why this rule is true
In a circle of m items, the first removal is at position (n − 1) mod m. What remains is a circle of m − 1 items, and counting restarts at the next position, which is n mod m.
That smaller game is just an ordinary game with m − 1 items whose starting point has been rotated. We already know its survivor sits J(m − 1) places after its starting point. Its starting point is n places around the original circle. So the survivor's original position is J(m − 1) + n, wrapped around with mod m. The removed item cannot be landed on by accident, since the smaller circle has only m − 1 places in it.
Worked example: n = 7
- J(1) = 0
- J(2) = (0 + 7) mod 2 = 1
- J(3) = (1 + 7) mod 3 = 2
- J(4) = (2 + 7) mod 4 = 1
- J(5) = (1 + 7) mod 5 = 3
- J(6) = (3 + 7) mod 6 = 4
Position 4 is E, matching the step-by-step table.
Worked example: n = 10
Emily and Jacob share no letters, so n is 10.
- J(2) = (0 + 10) mod 2 = 0
- J(3) = (0 + 10) mod 3 = 1
- J(4) = (1 + 10) mod 4 = 3
- J(5) = (3 + 10) mod 5 = 3
- J(6) = (3 + 10) mod 6 = 1
Position 1 is L, so the result is Lovers. The long way removes M, A, S, F, and E, leaving L.
Worked example: n = 6
Olivia and Noah leave 6 letters. The values from J(2) through J(6) are 0, 0, 2, 3, and 3. Position 3 is M: Marriage.
Be careful to use the positions in the right way. The intermediate values are positions in smaller, rotated circles. Only the final J(6) should be translated into a letter.
Why the Results Repeat Every 60
The shortcut uses n only through additions followed by mod 2, mod 3, mod 4, mod 5, and mod 6. If you add 60 to n, none of those remainders change, because 60 is divisible by 2, 3, 4, 5, and 6. Every J value stays the same, so the survivor does too.
The same holds for the entire elimination order, since each removal position is also a remainder by one of those circle sizes. A count of 67 removes F, A, S, L, M, exactly as 7 does.
Sixty is the least common multiple of 1 through 6. We also checked that no shorter cycle works: shifting by 30, for instance, does not preserve the results. And within one cycle, the 60 counts produce 60 different elimination orders. There are 720 ways to order six letters (five removals followed by the survivor), and FLAMES can reach just 60 of them.
Why Each Letter Wins Exactly Ten Times
Run the game for every n from 1 to 60 and each of F, L, A, M, E, and S wins ten times. That is a neat outcome, and it is not obvious in advance. Here is why it happens.
Step 1: group the counts by remainder mod 6
Choose a remainder r for n mod 6. Ten of the numbers from 1 to 60 have that remainder. The final step is J(6) = (J(5) + n) mod 6, which for this group is the same as (J(5) + r) mod 6.
Step 2: J(5) is evenly spread inside the group
J(5) = (J(4) + n) mod 5. The value J(4) is built only from remainders by 2, 3, and 4, so it is determined by n mod 12. The extra term depends on n mod 5.
Because 5 and 12 share no common factor, each combination of "n mod 12" and "n mod 5" occurs exactly once in a block of 60. Fixing n mod 6 allows two possible values of n mod 12, and each of those pairs with all five values of n mod 5. For either one, adding the five values to J(4) gives J(5) = 0, 1, 2, 3, 4 once each. So across the ten counts, every value of J(5) appears exactly twice.
Step 3: read off the winners
Adding r to J(5) shows that within the group, five of the six positions win twice each. The missing position is (r − 1) mod 6, which is precisely the letter removed first. That makes sense: it is gone before the others have competed.
Step 4: add the groups
There are six groups, and each letter is the first one removed in exactly one of them. So each letter wins twice in five groups and not at all in one, for a total of 10. That completes the proof.
| n mod 6 | Removed first | Wins among that group's ten counts |
|---|---|---|
| 1 | F | L, A, M, E, S twice each |
| 2 | L | F, A, M, E, S twice each |
| 3 | A | F, L, M, E, S twice each |
| 4 | M | F, L, A, E, S twice each |
| 5 | E | F, L, A, M, S twice each |
| 0 | S | F, L, A, M, E twice each |
The argument leaned on 5 having no factor in common with 12. It should not be assumed to carry over to circles of other sizes without checking.
Balanced in Theory, Lopsided in Practice
A balanced cycle does not mean a balanced game. Equal shares would require every count from 1 to 60 to be equally likely, and names do not work that way.
In a sample of 780 pairs made from 40 US-style first names (not an official popularity list), every count fell between 1 and 15. Counts of 5 through 9 accounted for 604 pairs. Enemies ended up with 290 pairs and Siblings with just 2. The elimination rule is the same; the inputs are concentrated on a few numbers. The details are in FLAMES result odds.
A Parity Fact From the Canceling Stage
The first stage has its own small theorem. Suppose the names have a and b letters, and you cancel c matching pairs. Then n = a + b − 2c.
Since 2c is even, n has the same parity as a + b. For Harper (6) and Logan (5), the total is 11 and one pair cancels, giving 9. You can tell the count will be odd before looking at a single letter.
The formula also shows how c is found. For each letter of the alphabet, take the smaller of the number of times it appears in the first name and in the second. Add those up. Then n is also the sum, over all letters, of the difference between the two tallies. This is why the order of letters within a name has no effect: Aiden's letters can be rearranged any way you like without changing n.
What a Computer Does With This
A program can follow the game literally, by keeping a list of six letters and deleting one at a time. It can also use the recurrence, which takes five small additions and remainders. Or it can store a table of 60 answers and look up n mod 60, treating a remainder of 0 as 60. All three agree. You can see such a table on our FLAMES count chart, or let the calculator on the home page handle the work.
Whatever the method, a count of zero has to be treated as a special case. It occurs when both inputs contain exactly the same letters, and the game defines no step of size zero.
Try It Yourself
These make good practice for anyone learning remainders.
- Use the recurrence for n = 4. You should finish at position 4, which is E.
- Use it for n = 8. You should finish at position 2, which is A.
- Predict the result for n = 68 without any new calculation. Since 68 − 60 = 8, it is also A.
- Change the word. Pick any other six symbols and confirm that the winning positions stay the same for each n, even though the labels differ.
The last exercise is worth a moment. The mathematics never reads the letters. It only chooses a position, and the word FLAMES hangs a label on it.
FAQ
Is FLAMES really the Josephus problem?
The elimination stage is: six items in a circle, with every n-th one removed until one remains. The letter-canceling stage is an extra step that chooses n.
Is there a single formula for the winner?
The recurrence J(m) = (J(m − 1) + n) mod m, applied up to m = 6, is a short and complete method. A 60-entry table is the other easy option.
Why do I have to restart at the next letter?
That is part of the rules, and the math depends on it. Restarting at F after each removal would be a different game with different results.
Does equal balance over 60 counts make the game fair?
It shows the elimination spreads wins evenly across a full cycle. Real names use only part of that cycle, so observed results are uneven.
Does the math say anything about compatibility?
No. It describes counting and remainders. The result is entertainment, not a forecast.
Try the FLAMES calculatorKeep reading
How Spelling and Nicknames Change FLAMES Results
See how spelling variants, nicknames, middle names and last names can change a FLAMES result, with checked examples and fair rules for picking names.
FLAMES Party Games: Fun Variations for Any Group
Play FLAMES at parties, sleepovers, class breaks and road trips with kid-friendly variations, simple scoring, and clear consent and kindness rules.
FLAMES vs. Love Calculators, Quizzes and More
How the FLAMES name game compares with love percentage calculators, MASH, paper fortune tellers, zodiac matches and online quizzes, just for fun.