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

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

cat("test\n")

N <- 1000
A <- list()
for (i in 0:N-1) {
    A[i+1] <- i # R lists are 1-indexed!
}

ans <- 0
for (i in A) {
    for (j in A) {
        ans <- gcd(i, j) + ans
    }
}
cat(ans)