Problem 14 in Julia