golfed version of euler 67, with different algo (top->bottom)