Common divisors
Given two numbers, you are asked to find the common divisors of those two.
The input contains 2 numbers.
The program should print the list of the common divisors without repetitions in increasing order separated by a space.
Input | Output |
6 12 | 1 2 3 6 |
8 12 | 1 2 4 |
Tip
Create a function
def divisors(n):
that would return a list of divisors of that number. Use this function to get the divisors for both numbers. div_a = divisors(a)
and same for b
.Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB