ruby version of prob 1
finished ruby, brute force of prob 6