Coprimes: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
||
Line 967: | Line 967: | ||
=={{header|R}}== |
=={{header|R}}== |
||
<lang |
<lang rsplus>factors <- function(n) c(Filter(function(x) n %% x == 0, seq_len(n %/% 2)), n) |
||
isCoprime <- function(p, q) all(intersect(factors(p), factors(q)) == 1) |
isCoprime <- function(p, q) all(intersect(factors(p), factors(q)) == 1) |
||
output <- data.frame(p = c(21, 17, 36, 18, 60), q = c(15, 23, 12, 29, 15)) |
output <- data.frame(p = c(21, 17, 36, 18, 60), q = c(15, 23, 12, 29, 15)) |