Example #1
0
def f(n):
    return numbertheory.contfrac2real([2]+[4]*(n-1))
Example #2
0
def f(n):
    return numbertheory.contfrac2real([1] + [1,2]*((n-1)//2)+[1]*((n-1)%2))
Example #3
0
import itertools
import numbertheory

def contfracE():
    yield 2
    n = 1
    while True:
        yield 1
        yield 2 * n
        yield 1
        n += 1

a = str(numbertheory.contfrac2real(list(itertools.islice(contfracE(), 100)))[0])
print(sum(list(map(int, (x for x in a)))))