Example #1
0
def proj():
    pnum = 100
    answer = 0

    x1, x2 = 1, 1
    cnt = 2
    keep_going = True
    mod = 10**9
    tot = 0
    while keep_going:
        cnt = cnt + 1
        xn = (x1 + x2) % mod
        x1, x2 = x2, xn
        if cnt < 2749:
            continue
        sys.stdout.write(" cnt = %d\r" % (cnt))
        if my_euler.is_pandigital(xn):
            if my_euler.is_pandigital(top9(cnt)):
                answer = cnt
                break
        if cnt > 10**6:
            print("Didn't find anything")
            keep_going = False

    print("")
    print_project_answer(pnum, answer)
Example #2
0
def proj():
    pnum = 100
    answer = 0

    x1, x2 = 1, 1
    cnt = 2
    keep_going = True
    mod = 10**9
    tot = 0
    while keep_going:
        cnt = cnt+1
        xn = (x1+x2) % mod
        x1, x2 = x2, xn
        if cnt<2749:
            continue
        sys.stdout.write(" cnt = %d\r" % (cnt))
        if my_euler.is_pandigital(xn):
            if my_euler.is_pandigital(top9(cnt)):
                answer = cnt
                break
        if cnt>10**6:
            print("Didn't find anything")
            keep_going = False

    print("")
    print_project_answer(pnum,answer)
Example #3
0
def is_b9_pan(n):
    cnt = my_euler.count_dig(n)
    if cnt < 9:
        return False
    mod = 10**9
    b9 = n % mod
    return my_euler.is_pandigital(b9)
Example #4
0
def is_b9_pan ( n ):
    cnt = my_euler.count_dig(n)
    if cnt<9:
        return False
    mod = 10**9
    b9 = n%mod
    return my_euler.is_pandigital(b9)
Example #5
0
def is_t9_pan(n):
    cnt = my_euler.count_dig(n)
    if cnt < 9:
        return False
    shift = cnt - 9
    div = 10**shift
    t9 = n // div
    return my_euler.is_pandigital(t9)
Example #6
0
def is_t9_pan ( n ):
    cnt = my_euler.count_dig(n)
    if cnt<9:
        return False
    shift = cnt-9
    div = 10**shift
    t9 = n//div
    return my_euler.is_pandigital(t9)
Example #7
0
def test02():
    n = 3
    if 2 == ac:
        n = int(av[1])
    y = my_euler.fibonacci(n)
    cnt = my_euler.count_dig(y)
    if cnt > 9:
        shift = cnt - 9
    div = 10**shift
    ym = y // div
    if my_euler.is_pandigital(ym):
        print("Last 9 (%d) is pandigital" % ym)
    else:
        print("Last 9 (%d) is not pandigital" % ym)
Example #8
0
def test01():
    n = 3
    if 2 == ac:
        n = int(av[1])
    y = my_euler.fibonacci(n)
    print("fib(%d) = %d" % (n, y))
    cnt = my_euler.count_dig(y)
    print("  has %d digits" % cnt)
    mod = 10**9
    ym = y % mod
    if my_euler.is_pandigital(ym):
        print("Last 9 (%d) is pandigital" % ym)
    else:
        print("Last 9 (%d) is not pandigital" % ym)
Example #9
0
def test02():
    n = 3
    if 2==ac:
        n = int(av[1])
    y = my_euler.fibonacci(n)
    cnt = my_euler.count_dig(y)
    if cnt>9:
        shift = cnt-9
    div = 10**shift
    ym = y // div
    if my_euler.is_pandigital(ym):
        print("Last 9 (%d) is pandigital" % ym)
    else:
        print("Last 9 (%d) is not pandigital" % ym)
Example #10
0
def test01():
    n = 3
    if 2==ac:
        n = int(av[1])
    y = my_euler.fibonacci(n)
    print("fib(%d) = %d" % (n,y))
    cnt = my_euler.count_dig(y)
    print("  has %d digits" % cnt)
    mod = 10**9
    ym = y % mod
    if my_euler.is_pandigital(ym):
        print("Last 9 (%d) is pandigital" % ym)
    else:
        print("Last 9 (%d) is not pandigital" % ym)