The Madelung constant in N dimensions