#!/usr/local/bin/ruby m, c = 0, 0 while m = m + 1 puts m c + 1 if m % 4 == 0 c + 1 if m % 9 == 0 break if c >= 30 end puts m