Solve nth_prime, leap, grains, word-count in ruby and bob in javascript