You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2015/ruby/day_10.rb

10 lines
207 B

class Integer
def look_and_say
self.to_s.chars.slice_when {|a,b| a != b }.map {|i| "#{i.size}#{i[0]}" }.join.to_i
end
end
seed = 1113122113
50.times { seed = seed.look_and_say }
puts seed.to_s.size