added solution to problem20, very similar to 16