← RoseCode

ROSECODE 551

Bonus for p550

C_K_Yang · Math ·

Given two natural numbers a and b with 1<ab, let J(a,b,N) be the set which contains all natural numbers not greater than N and not divisible by any number between a and b(inclusive). For example, J(4,6,10)={1,2,3,7,9}

  • 4 can divide 4 and 8
  • 5 can divide 5 and 10
  • 6 can divide 6
  • Hence 4,5,6,8 and 10 will not appear in the set which J(4,6,10) represents. Although they are all not greater than 10.

    We define the product of a set as the product of all elements in that set, written as P({...}) where {...} is a specific set. For example, P(J(4,6,10))=1×2×3×7×9=378

    Finally, We define a function D(a,b,N,K) as the sum of product of sets over all J(a,b,N)'s subsets which contain exactly K elements.

    In other words, D(a,b,N,K)=SJ(a,b,N), len(S)=KP(S)

    You are given D(5,8,20,3)=46035 and D(7,12,3000,10)mod(1018+3)=736056499082019203

    Find i=1150D(11,20,1120,i)

    Give your answer modulo (1018+3)


    [My timing: 18 s(Python)]