Ad
  • Default User Avatar

    I did exactly that, O(1) for one prime and using inclusion-exclusion means that I have to do that binom(n, k) times for 1 <= k <= n.
    I pass 6 out of 6 30 digits tests but then my code times out. Am I still missing something?