login
a(n) = denominator of b(n): b(n) = the maximum possible value for a continued fraction whose terms are a permutation of the terms of the simple continued fraction for H(n) = sum{k=1 to n} 1/k, the n-th harmonic number.
4

%I #23 Mar 13 2026 18:04:32

%S 1,1,2,2,14,12,47,74,751,455,1609,3281,115912,23276,13920,162643,

%T 1613467,107881,6816743,1825459,245428,769416,48264683,24515971,

%U 1069940948,821503527,1565820591,3095313533,110858310133,16156751822

%N a(n) = denominator of b(n): b(n) = the maximum possible value for a continued fraction whose terms are a permutation of the terms of the simple continued fraction for H(n) = sum{k=1 to n} 1/k, the n-th harmonic number.

%H Alois P. Heinz, <a href="/A129083/b129083.txt">Table of n, a(n) for n = 1..750</a>

%e The continued fraction for H(5) = 137/60 is [2;3,1,1,8]. The maximum value a continued fraction can have with these same terms in some order is [8;1,3,1,2] = 123/14.

%p H := proc(n) add(1/k,k=1..n) ; end: Ltoc := proc(L) numtheory[nthconver](L,nops(L)-1) ; end: r := proc(n) option remember ; local m,rL,rp,L ; if n = 1 then 1; else rL := numtheory[cfrac](H(n),'quotients') ; rp := combinat[permute](rL) ; m := Ltoc(rL) ; for L in rp do m := max(m, Ltoc(L)) ; od: m ; fi; end: A129083 := proc(n) denom(r(n)) ; end: for n from 1 do printf("%d,\n", A129083(n)) ; od: # _R. J. Mathar_, Jul 30 2009

%p # Alternative:

%p with(numtheory):

%p H:= proc(n) option remember; `if`(n=1, 1, H(n-1)+1/n) end:

%p r:= proc(l) local j;

%p infinity; for j from nops(l) to 1 by -1 do l[j]+1/% od

%p end:

%p sh:= proc(l) local ll, h, s, m; ll:= []; h:= nops(l); s:= 1; m:= h; while s<=h do ll:= [ll[],l[m]]; if m=h then h:= h-1; m:= s else s:= s+1; m:= h fi od; ll end:

%p a:= n-> denom(r(sh(sort(cfrac(H(n), 'quotients'))))):

%p seq(a(n), n=1..40); # _Alois P. Heinz_, Aug 04 2009

%t r[l_] := Module[{lj, j}, For[lj = Infinity; j = Length[l], j >= 1, j--, lj = l[[j]] + 1/lj]; lj];

%t sh[l_] := Module[{ll, h, s, m}, ll = {}; h = Length[l]; s = 1; m = h; While[s <= h, ll = Append[ll, l[[m]]]; If[m == h, h--; m = s, s++; m = h ]]; ll];

%t a[n_] := Denominator[ r[ sh[ Sort[ ContinuedFraction[ HarmonicNumber[n]]]]] ];

%t Table[a[n], {n, 1, 40}] (* _Jean-François Alcover_, Mar 20 2017, after _Alois P. Heinz_ *)

%o (Magma) Q:=Rationals(); [ Denominator(Max([ r: r in R ])) where R:=[ c[1,1]/c[2,1]: c in C ] where C:=[ Convergents(s): s in S ] where S:=Seqset([ [m(p[i]):i in [1..#x] ]: p in P ]) where m:=map< x->y | [<x[i],y[i]>:i in [1..#x] ] > where P:=Permutations(Seqset(x)) where x:=[1..#y]: y in [ ContinuedFraction(h): h in [ &+[ 1/k: k in [1..n] ]: n in [1..8] ] ] ]; // _Klaus Brockhaus_, Jul 31 2009

%Y Cf. A129082, A129084, A129085.

%K frac,nonn

%O 1,3

%A _Leroy Quet_, Mar 28 2007

%E 6 more terms from _R. J. Mathar_, Jul 30 2009

%E Extended beyond a(12) _Alois P. Heinz_, Aug 04 2009