Hat-tip to TSK for this amazing Harry Potter fanfic. Here’s a taste, selected for the pleasure of my computer science friends:
And when Harry opened his eyes, he saw just what he’d been hoping to see, a folded piece of paper left on the floor, the gift of his future self.
Call that piece of paper “Paper-2”.
Harry tore a piece of paper off his pad.
Call that “Paper-1”. It was, of course, the same piece of paper. You could even see, if you looked closely, that the ragged edges matched.
Harry reviewed in his mind the algorithm that he would follow.
If Harry opened up Paper-2 and it was blank, then he would write “101 x 101” down on Paper-1, fold it up, study for an hour, go back in time, drop off Paper-1 (which would thereby become Paper-2), and head on up out of the cavern level to join his dorm mates for breakfast.
If Harry opened up Paper-2 and it had two numbers written on it, Harry would multiply those numbers together.
If their product equaled 181,429, Harry would write down those two numbers on Paper-1 and send Paper-1 back in time.
Otherwise Harry would add 2 to the number on the right and write down the new pair of numbers on Paper-1. Unless that made the number on the right greater than 997, in which case Harry would add 2 to the number on the left and write down 101 on the right.
And if Paper-2 said 997 x 997, Harry would leave Paper-1 blank.
Which meant that the only possible stable time loop was the one in which Paper-2 contained the two prime factors of 181,429.
If this worked, Harry could use it to recover any sort of answer that was easy to check but hard to find. He wouldn’t have just shown that P=NP once you had a Time-Turner, this trick was more general than that. Harry could use it to find the combinations on combination locks, or passwords of every sort. Maybe even find the entrance to Slytherin’s Chamber of Secrets, if Harry could figure out some systematic way of describing all the locations in Hogwarts. It would be an awesome cheat even by Harry’s standards of cheating.
Harry took Paper-2 in his trembling hand, and unfolded it.






