Skip to content
Prev 171507 / 398503 Next

All the products of common factors

Fox, Gordon <gfox <at> cas.usf.edu> writes:
This is somewhat brute force, but how about

commfac <- c(1,2,2,2,5)
cfun <- function(i) { combn(commfac,i,prod) }
L <- lapply(as.list(1:length(commfac)),cfun)
unique(sort(unlist(L)))

  ?

  Ben Bolker