Forum Discussion

davidleal's avatar
davidleal
Iron Contributor
Apr 04, 2023

Efficient approach to generate list of combinations with no repetition

I am trying to find the best way to generate the combination with no repetition, i.e. the corresponding set related to the total of a combination of COMBIN(n,m) output. I found several approaches wit...
  • PeterBartholomew1's avatar
    Apr 04, 2023

    davidleal 

    Forgive me for asking, but have I got the wrong end of the stick here?

    = IF(Combinationsλ(n,m), "●","-")
    
    Combinationsλ
    = LET(
        k, 2 ^ SEQUENCE(1, n, 0),
        h, SEQUENCE(2 ^ n),
        p, SIGN(BITAND(h, k)),
        f, BYROW(p, LAMBDA(p, SUM(p))) = m,
        FILTER(p, f)
      )

Resources