Skip to main content
2 of 2
added 20 characters in body
mad
  • 51
  • 3

BQN, 26 bytes

{+´0=𝕨|+´¨1+(⥊(↕2˘)/¨<)↕𝕩}

This block takes n as its right argument and k as its left one

Explanation:

    {
     +´                         # count (sum of booleans)
       0=𝕨|                     # values divisible by left argument (k)
            +´¨1+(⥊(↕2˘)/¨<)↕𝕩  # in the list of the sums of the subsets
                 (⥊(↕2˘)/¨<)    #   get all the subsets of
                            ↕𝕩  #   all natural integers inferior to the right argument (n)
            +´¨1+               #   +1 (otherwise values would go from 0 to (n-1) instead of the expected 1 to n)
                               }
mad
  • 51
  • 3