(Python) def rn(num): ....rs = '' ....table=[['M',1000],['CM',900],['D',500],['CD',400],['C',100],['XC',90],['L',50],['XL',40],['X',10],['IX',9],['V',5],['IV',4],['I',1]] ....sub = {'M':'1000', ............'D':'500', ............'C':'100', ............'L':'50', ............'X':'10', ............'V':'5', ............'I':'1'} ....look = ['MMM','MM','M','D','CCC','CC','C','L','XXX','XX','X','V','III','II','I'] ....for pair in table: ........while num-pair[1]>=0: ............num-=pair[1] ............rs+=pair[0] ....send = '' ....x = 0 ....while x < len(rs): ........for y in look: ............if y == rs[x:x+len(y)]: ................send += str(len(y)) ................send += sub[y[0]] ................x += len(y) ....return send with open("A180105b.txt","w") as g: ....for a in range(1,4000): ........g.write(str(a)+" "+rn(a)+"\n") # _David Consiglio, Jr._, Oct 12 2015