An extremal property of the normal distribution, with a discrete analog