Programming solutions to different math problems