brute force solution to 41 in ruby