aboutsummaryrefslogtreecommitdiff
path: root/test.js
blob: e12086c2b94acc1f23e6afd53ee22442b73e39c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Node.js

function gcd(a, b) {
    if (b > 0) return gcd(b, a % b);
    else return a;
}

console.log("test");

const N = 1000;
var A = [];
for (var i = 0; i < N; i++) {
    A.push(i);
}

var ans = 0;
for (i of A) {
    for (j of A) {
        ans += gcd(i, j);
    }
}
console.log(ans);