Created
September 7, 2018 15:11
-
-
Save rileypeterson/a5c80a2a57c4bd74b03a1bac2a049c1c to your computer and use it in GitHub Desktop.
Yield continued fraction coefficients for Napier's constant (e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def A003417(): | |
n = 0 | |
while True: | |
if n == 0: | |
yield 2 | |
if n == 1: | |
yield 1 | |
else: | |
if (n+1) % 3 == 0: | |
yield int(2 * ((n+1) / 3)) | |
else: | |
yield 1 | |
n += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment