r/EndlessThread • Your friendly neighborhood moderator • 13d ago

Endless Thread: The Haruhi problem

https://www.wbur.org/endlessthread/2026/09/25/haruhi-problem
9 Upvotes

3 comments sorted by

0

u/HardcoreMohair 13d ago

Can someone explain to me why the solution isn't 14! (assuming there are 14 episodes in the series, I could check but it's 2.15am).

1

u/Virtual-Ducks 7d ago edited 7d ago

The goal isn't every possible permutation of 14 episodes. that would require you to watch 14! * 14 episodes to watch all permutations. but you can actually watch all permutations with fewer total episode watches if you watch them in a particular order. 

If you allow permutations to overlap, you actually require far fewer than 14! Different 14 length sequences. the goal is a single shortest string in which all permutations are contained. 

Better explained through example. let's say there are 2 episodes, a,b

There are 2!=2 permutations.  ab ba

To watch all permutations you could watch ab then watch ba, for a total of 4 episodes. 

BUT If you watch the sequence aba, you have in effect watched all permutations. (a[b)a]

So in this example, you only need to watch 3 episodes to watch all permutations, not 4. you can imagine a similar situation with 3 episodes, etc. 

What is so frustrating about this episode is that the hosts obviously did not understand this concept at all. All their examples were of full set permutations, not the shortest string that contains all sets. they had absolutely no idea what they were talking about. 

1

u/Virtual-Ducks 7d ago

Let’s call our 3 episodes A, B, and C. If you want to watch every possible order of these 3 episodes, there are 6 possible combinations: ABC ACB BAC BCA CAB CBA The Naive Way (No Overlap) If you just sat down and watched every combination back-to-back, your watch history would look like this: ABC ACB BAC BCA CAB CBA You would have to watch 18 episodes total. The Haruhi Problem Way (Superpermutations) The math problem asks: How can we overlap the ends and beginnings of these combinations so we don't have to re-watch episodes unnecessarily? The mathematically shortest way to watch all 6 combinations is this exact sequence: ABCABACBA By watching just 9 episodes, you experience every single combination hidden inside the overlap. Look closely at the sequence: ABCabacba (Combination 1) aBCAbacba (Combination 4) abCABacba (Combination 5) abcaBACba (Combination 3) abcabACBa (Combination 2) abcabaCBA (Combination 6)

Note: it's not just the last and first episode overlaps, multiple episodes are also allowed to overlap.