A student working in DNA research had the task of finding repeated sequences of M values in a long sequence of values:
ACTCGGATCTTGCATTTCGGCAATTGGACCCTGACTTGGCCA ...
Wrote the simplest (and therefore, most efficient?) program:
DO 10 I = 1, N-M
DO 10 J = I+1, N-M
FOUND = .TRUE.
DO 20 K = 1, M
20 IF X[I+K-1] .NE. X[J+K-1] THEN FOUND = .FALSE.
IF FOUND THEN ...
10 CONTINUE
Took a depressingly long time.