Sha256: 5a31edd767743032377fea82fa594530170d76467c229e43f27e55fdcef8c060
Contents?: true
Size: 216 Bytes
Versions: 168
Compression:
Stored size: 216 Bytes
Contents
collatz <- function(num) { if (num <= 0) stop("num must be positive") else if (num == 1) return(0) else if (num %% 2 == 0) return(1 + collatz(num / 2)) else return(1 + collatz(3 * num + 1)) }
Version data entries
168 entries across 168 versions & 1 rubygems