Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A373893
a(n) is the length of the simple continued fraction for the n-th alternating harmonic number.
1
0, 1, 2, 4, 7, 7, 5, 9, 8, 12, 9, 12, 11, 12, 13, 12, 18, 12, 17, 15, 15, 15, 19, 21, 18, 13, 21, 23, 25, 23, 26, 32, 28, 25, 24, 24, 31, 32, 33, 36, 41, 38, 38, 37, 44, 41, 37, 39, 47, 48, 42, 43, 43, 44, 46, 42, 44, 51, 45, 49, 52, 53, 62, 50, 57, 48, 55, 60, 52, 58, 70, 58, 60, 73, 67
OFFSET
1,3
COMMENTS
By "simple continued fraction" is meant a continued fraction whose terms are positive integers and the final term is >= 2.
EXAMPLE
Sum_{k=1..7} (-1)^(k+1)/k = 319/420 = 1/(1 + 1/(3 + 1/(6 + 1/(3 + 1/5)))), so a(7) = 5.
MATHEMATICA
Table[Length[ContinuedFraction[Sum[(-1)^(k + 1)/k, {k, 1, n}]]] - 1, {n, 1, 75}]
PROG
(Python)
from fractions import Fraction
from sympy.ntheory.continued_fraction import continued_fraction
def A373893(n): return len(continued_fraction(sum(Fraction(1 if k&1 else -1, k) for k in range(1, n+1))))-1 # Chai Wah Wu, Jun 27 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jun 21 2024
STATUS
approved