#Python 2, 116 bytes Meh. Not that short. The simple iterative solution. <!-- language: lang-python --> L=[1,2,3] n=input() while len(L)<n: for i in range(2,n): if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break print L[-1] [**Try it online**][1] [1]: https://tio.run/nexus/python2#JclBDsIgEADAs/uK9QYRDdQbLT/YHxAOqFQ3NtuG0Ph8NPE2yXQK0ZnBXBNIYNn2pjR8XrwUXIoo0pN4wHmtyMiCNcuzqMGI9nDgGelyX3dpivVEkc8uZXkgxR@OgT2dQuQ03mrJb9gqS/tf785a@wU