Cycle length persisted

Instead of maintaining a flag, stored cycle length of each i. This
tremendously reduced execution time.