extended successor to work for more than n = 3