karansiwach360's blog

By karansiwach360, history, 8 years ago, In English

Hi, Can someone please help me out with this problem which appeared in Ad Infinitum 17 on Hackerrank.

Problem Link: https://www.hackerrank.com/contests/infinitum17/challenges/number-of-m-coprime-arrays

Thanks!

  • Vote: I like it
  • +10
  • Vote: I do not like it

»
8 years ago, # |
Rev. 7   Vote: I like it +8 Vote: I do not like it

Consider some prime P in factorization, sequence of powers should not have two consecutive non-zero powers, then you can multiply answers over distinct primes since they are independent. The first part can be done by matrix multiplication. Hint: matrix should have 2x2 size.