def testSuccess(self): self.assertTrue(euler.isPandigital(1)) self.assertTrue(euler.isPandigital(12)) self.assertTrue(euler.isPandigital(213)) self.assertTrue(euler.isPandigital(321)) self.assertTrue(euler.isPandigital(4312)) self.assertTrue(euler.isPandigital(7456321)) self.assertTrue(euler.isPandigital(987561243))
def testFailure(self): self.assertFalse(euler.isPandigital(0)) self.assertFalse(euler.isPandigital(2)) self.assertFalse(euler.isPandigital(-1)) self.assertFalse(euler.isPandigital(11)) self.assertFalse(euler.isPandigital(13)) self.assertFalse(euler.isPandigital((3988))) self.assertFalse(euler.isPandigital(535))
import euler primes = euler.primeGen(7654321) primeList = [x for x in range(len(primes)) if primes[x]] for prime in reversed(primeList): print(prime) if euler.isPandigital(prime): break print(prime)
from euler import isPandigital max = 123456789 for num in xrange(10000, 100000): for lim in range(1, 10): cat = '' for n in range(1, lim + 1): cat += str(num * n) if len(cat) > 9: break if isPandigital(cat) and int(cat) > max: max = int(cat) print max
from euler import (Primes, isPandigital) p = Primes(100000000) for num in [x for x in p.primes if isPandigital(str(x))]: print num