10 lines
357 B
Text
10 lines
357 B
Text
harmonic(n):=apply("+",1/makelist(i,i,n))$
|
|
|
|
first_greater_than_n(len):=block(i:1,result:[],while harmonic(i)<=len do (result:endcons(i,result),i:i+1),last(result)+1)$
|
|
|
|
/* Test cases */
|
|
/* First 20 harmonic numbers */
|
|
makelist(harmonic(j),j,20);
|
|
|
|
/* First harmonic number that exceeds a positive integer from 1 to 5 */
|
|
makelist(first_greater_than_n(k),k,5);
|