← RoseCode

ROSECODE 056

Convergents of e

elasolova · Programming ·

Square root of 2 can be represented as [1;(2)] where (2) means 2 repeats ad infinitum. In a similar way, sqrt(23)=[4;(1,3,1,8)] (Note:Continued Fraction)
Surprisingly,
e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].
The first ten terms in the sequence of convergents for e are:
2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536, ...
Find the sum of digits in the numerator of the 1000th convergent of the continued fraction for e.

Note: An extension of Project Euler Problem 65