Beispiel #1
0
def g():
    x = 1
    while 1 > 0:
        l = lintstr(permuta(str(x)))
        if x % 100 == 0:
            print x
        if 2 * x not in l:
            x += 1
            continue
        if 3 * x not in l:
            x += 1
            continue
        if 4 * x not in l:
            x += 1
            continue
        if 5 * x not in l:
            x += 1
            continue
        if 6 * x not in l:
            x += 1
            continue
        return x
Beispiel #2
0
from utils import sieve, permuta, lintstr
from math import sqrt

l = sieve(int(sqrt(7654321)))

a = permuta("7654321")
a.reverse()

def check(x):
  for y in l:
    if x%y == 0: return 0
  return 1

def f():
  for x in a:
    if check(int(x))==1: return x
  return 0



print f()

Beispiel #3
0
def f():
  s = 0
  for x in permuta("1234567890"):
   
    if check(x): s+=int(x)
  return s