OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
EXAMPLE
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.
MAPLE
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: A129082 := proc(n) numer(r(n)) ; end: for n from 1 do printf("%d, \n", A129082(n)) ; od: # R. J. Mathar, Jul 30 2009
# second Maple program:
with(numtheory):
H:= proc(n) option remember; `if`(n=1, 1, H(n-1)+1/n) end:
r:= proc(l) local j;
infinity; for j from nops(l) to 1 by -1 do l[j]+1/% od
end:
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:
a:= n-> numer(r(sh(sort(cfrac(H(n), 'quotients'))))):
seq(a(n), n=1..40); # Alois P. Heinz, Aug 04 2009
MATHEMATICA
r[l_] := Module[{lj, j}, For[lj = Infinity; j = Length[l], j >= 1, j--, lj = l[[j]] + 1/lj]; lj];
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];
a[n_] := Numerator[ r[ sh[ Sort[ ContinuedFraction[ HarmonicNumber[n]]]]]];
Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 20 2017, after Alois P. Heinz *)
PROG
(Magma) Q:=Rationals(); [ Numerator(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
CROSSREFS
KEYWORD
frac,nonn
AUTHOR
Leroy Quet, Mar 28 2007
EXTENSIONS
6 more terms from R. J. Mathar, Jul 30 2009
Extended beyond a(12) Alois P. Heinz, Aug 04 2009
STATUS
approved