#!/usr/bin/ruby def sum(last, current, sum) if current >= 4000000 return sum end if current % 2 == 0 sum += current end tmp = current current += last last = tmp sum(last, current, sum) end puts sum(0, 1, 0)