Exemple #1
0
def solve():
    maxX = 0
    maxD = 0
    for d in xrange(2, 1001):
        if d in squares:
            continue
        for (x,y) in convergents(sqrtCF(d)):
            if x*x - d * y * y == 1:
                if x > maxX:
                    maxX = x
                    maxD = d
                break
    return maxD
Exemple #2
0
def solve():
    return sum(int(c) for c in str(nth(convergents(eCF()), 99)[0]))
Exemple #3
0
def solve():
    cf = chain([1], repeat(2))
    return sum(1 for (n,d) in islice(convergents(cf), 1, 1001)
                 if floor(log10(n)) > floor(log10(d)))