func lookandsay(str) { str.gsub(/((.)\2*)/, {|a,b| a.len.to_s + b }); } var num = "1"; { say num; num = lookandsay(num); } * 10;