New synthesis of 2-alkylpyrrolidines and 2-alkylpiperidines