Number of common divisors

SPOJ - COMDIV