def divnum(x): out = [] while x > 0: out.append(x % 10) x /= 10 return out def testnum(x, n): a = divnum(x) for i in xrange(2, n + 1): b = divnum(x * i) if set(a) != set(b): return False return True n = 1 while n < 1000000: if testnum(n, 6): break n += 1 for i in xrange(1, 7): print n * i