login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the number of terms in the continued fraction of the absolute value of B_{2n}, the (2n)-th Bernoulli number.
6

%I #22 Apr 14 2023 10:53:44

%S 1,2,2,2,2,3,6,2,7,7,4,4,6,2,6,7,7,2,10,2,8,2,3,5,10,3,7,7,6,6,17,2,7,

%T 10,2,7,23,2,2,5,18,5,16,2,10,14,6,2,18,2,9,5,7,6,18,4,15,2,6,2,17,2,

%U 2,15,7,9,12,2,8,11,12,2,21,2,6,14,2,4,23,2

%N a(n) is the number of terms in the continued fraction of the absolute value of B_{2n}, the (2n)-th Bernoulli number.

%C The continued fraction terms being counted include the initial 0, if there is one.

%H Vaclav Kotesovec, <a href="/A138705/b138705.txt">Table of n, a(n) for n = 0..10000</a>

%e The 12th Bernoulli number is -691/2730. Now 691/2730 has the continued fraction 0 + 1/(3 + 1/(1 + 1/(19 + 1/(3 + 1/11)))), which has 6 terms (including the zero). So a(6) = 6.

%t Table[Length[ContinuedFraction[Abs[BernoulliB[2*n]]]], {n, 0, 100}] (* _Vaclav Kotesovec_, Oct 03 2019 *)

%o (PARI) a(n) = #contfrac(abs(bernfrac(2*n))); \\ _Jinyuan Wang_, Aug 07 2021

%o (Python)

%o from sympy import continued_fraction, bernoulli

%o def A138705(n): return len(continued_fraction(abs(bernoulli(n<<1)))) # _Chai Wah Wu_, Apr 14 2023

%Y Cf. A027641/A027642, A138704, A138706.

%K nonn

%O 0,2

%A _Leroy Quet_, Mar 26 2008

%E a(8)-a(70) from _Lars Blomberg_, Mar 16 2012