Sareja and gcd test case explanation

i have one serious doubt on this problem in DEC14 can anyone give me the correct explanation to this problem.

PS: if your answer reveals strategy than plz dont.

1 Like

No of ways of picking N elements from the set {1 to M} (also the permutation of numbers should be considered) such that each element can be picked greater than or equal to once and gcd of elements is D .

i think this explains sufficiently .


and there can be repitition of numbers

@acodebreaker, not only combinations, but also permutations of the selected numbers.

In SEAGCD large memory has been used by some of the coders. Does that imply that large arrays and data structures
are possible.??

i forget that in hurry , thnx , corrected :slight_smile:

[2,2,2,4,4] and [4,4,2,2,2] are two different arrays am I right in this case??

could you explain the case for d=1???

yes, you are right :slight_smile:

think it yourself , no help during the contest