Challenge Level

Every day I go to the swimming pool and swim the same number of lengths. I like to count the number of lengths I've done as I go as a fraction of the total number of lengths I'm going to do that day.

If I swam ten lengths a day...

- After five lengths I would say to myself, "I've managed $\frac{5}{10}$ of my day's swimming, which simplifies to $\frac{1}{2}$."
- After seven lengths, I would say "I've managed to swim a prime number of lengths."
- After eight lengths, I would say "I've done $\frac{8}{10}$ of my day's swimming, which simplifies to $\frac{4}{5}$."
- After nine lengths, I'd say "I've done 9 lengths, which isn't prime, and $\frac{9}{10}$ does not simplify."

I don't swim ten lengths a day. In fact, the total number of lengths I swim each day is rather special...

Let's call the total number of lengths I swim $n$.

After the first length, for every length I swim, the total so far (let's call it $t$) is either a prime number, or the fraction $\frac{t}{n}$ will simplify (or both).

It is, in fact, the largest number for which this is true.

**Can you work out how many lengths I swim each day?**