Problem 24 in Julia