For a prime , if divides then divides . For other numbers it can fail. You will find every divisor from to that fails, and look at what they have in common.
The idea. For one , try and look for an where divides but not .
Your tasks.
divides, return True when d divides n exactly.first_failure, return the smallest a from to with d dividing a * a but not a. Return None if there is none.failing with the divisors d from to that have a failure, in order.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…