Hong-Phuc Bui
2025-01-16 2889de7f0c2d587a17fbd322af57c29e84238620
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * harmonic.js
 *
 */
 
import {terminal} from "./dfhi.js";
 
window.main = function(...argv) {
    const n = Number.parseInt(argv[0]);
    let h = 0;
    for(let i = 1; i <=n; ++i) {
        h += 1/i;
    }
    terminal.printl(`H_${n} = ${h}`);
};