示例#1
0
def main():
    """Main program."""
    answer = 0

    start_time = time.time()

    if len(sys.argv) > 1:
        lim = int(sys.argv[1])
    else:
        lim = 5000
    n = 10
    c = 0
    while c < lim:
        S = list(primerange(0, n))
        m = len(S)
        c = count_partitions(S, m, n)
        n = n + 1

    answer = n - 1 # subtract off the last increment of n

    end_time = time.time()
    print("The answer is %d" % answer)
    print("%f seconds elapsed." % (end_time - start_time))

    import pyperclip
    pyperclip.copy(str(answer))
    print("The answer has been placed in the clipboard.")
示例#2
0
def main():
    """Main program."""
    answer = 0
    start_time = time.time()
    n = int(sys.argv[1])
    S = list(range(1, n))
    m = len(S)
    answer = count_partitions(S, m, n)
    end_time = time.time()
    print("The answer is %d" % answer)
    print("%f seconds elapsed." % (end_time - start_time))

    import pyperclip
    pyperclip.copy(str(answer))
    print("The answer has been placed in the clipboard.")