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.
Unfriendly Numbers
Unfriendly Numbers
Sort by
recency
|
20 Discussions
|
Please Login in order to post a comment
This problem is a great way to practice working with divisors and understanding the concept of unique factors. sabexch registration
With gcd or without gcd, I can not pass last 2 test case due to timeout. Using PHP.
Full Solution in Python:
I didn't find a single proper solution or even hint in discussion, so I wrote this.
hint: If factor of f divides an unfriendly number, then factor of f also divides gcd(unfriendly number, f)
Solution in python:
Java 8