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.
6 12
1 2 3 6
8 12
1 2 4
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.


Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue