Harmonic number sum

Problem1: Least k such that H(k) >= n, where H(k) is the harmonic number sum_{i=1..k} 1/i.

It returns:

a(1)=1
a(2)=4
a(3)=11
a(4)=31
a(5)=83
a(6)=227
a(7)=616
a(8)=1674
a(9)=4550
a(10)=12367
a(11)=33617
a(12)=91380
a(13)=248397
a(14)=675214
a(15)=1835421
a(16)=4989191
a(17)=13562027
a(18)=36865412
a(19)=100210581
a(20)=272400600

Problem2: Least k such that H(k) >= n, where H(k) is the harmonic number sum_{i=n..k} 1/i.

Note: The sequence was published at :http://www.research.att.com/~njas/sequences/A168214

It returns:

a(1)=1
a(2)=11
a(3)=51
a(4)=192
a(5)=669
a(6)=2222
a(7)=7135
a(8)=22374
a(9)=68916
a(10)=209348
a(11)=628916
a(12)=1872269
a(13)=5531641
a(14)=16238866
a(15)=47410139

你可能感兴趣的:(J#)