logic works, but has an infinite loop with the 2,4,8,0,0,0... sequence