Combinations with repetitions: Difference between revisions

m
→‎{{header|R}}: Syntax highlighting.
(add non recursive solution)
m (→‎{{header|R}}: Syntax highlighting.)
Line 3,167:
=={{header|R}}==
The idiomatic solution is to just use a library.
<lang Rrsplus>library(gtools)
combinations(3, 2, c("iced", "jam", "plain"), set = FALSE, repeats.allowed = TRUE)
nrow(combinations(10, 3, repeats.allowed = TRUE))</lang>
331

edits