From: Faith Tarcha Date: 2012-02-07T20:03:47+09:00 Subject: Re: Easy loop question Yes, this is the easiest way to do it: def f n # this function calculates next number in your sequence if n % 2 == 0 # n is even return n / 2 else return n * 3+1 end end num = gets.to_i # read in a number while num < 1 # infinitely... num = f(num) # find the next number puts num # print it sleep 1 # wait one second end Does anyone know how you can make it count all the numbers in the loop (until it reaches number 1)? -- Posted via http://www.ruby-forum.com/.