I am trying to obtain the least common multiplier of the prime numbers in between 1 and 20:
x <- expand.grid(c(2,3,7,11,13,17,19),c(2,3,7,11,13,17,19))
l <- c()
# loop
for(i in length(x[,1])){
l[i] <- pracma::Lcm(x[i, 1], x[i, 2])
}
# gives
tail(l)
[1] NA NA NA NA NA 19
Interestingly, the loop returns only NA's besides the first and last value, this doesn't make sense since one can obtain the values by hand:
pracma::Lcm(x[4, 1], x[4, 2])
[1] 22
Can anyone spot what I am missing?
Thank you in advance!