We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Checked the solution after solving it. Turns out the author's solution is not the most optimal possible solution. A hint: the function is multiplicative, so try to think of the product as a product of prime powers. Then see if you can figure out what the powers of those primes are in the product.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
GCD Product
You are viewing a single comment's thread. Return to all comments →
Checked the solution after solving it. Turns out the author's solution is not the most optimal possible solution. A hint: the function is multiplicative, so try to think of the product as a product of prime powers. Then see if you can figure out what the powers of those primes are in the product.