in reply to Re: Finding repeat sequences.
in thread Finding repeat sequences.

It is to find the shortest pattern, otherwise $n==1 always.

Correction: replaced $n=1 with $n==1