A Looping Algorithm