Update example program to repeat instead of halting at the end, and count number of full iterations.