from sys import argv def partition(n,maxk=None): assert(n>=0) if n == 0: yield [] else: if maxk==None: maxk=n for k in range(min(n,maxk),0,-1): for P in partition(n-k,k): yield [k]+P def c(P): return list(sorted([p*P.count(p) for p in set(P)],reverse=True)) for n in range(int(argv[1])): Q = set(str(c(P)) for P in partition(n)) print n,len(Q)