Corrected generating algorithm for odd n