Common Prime Factors

0

0 votes
Problem

Input two numbers.

Find prime factors of both the numbers and display sum of those prime factors which are common to both the numbers.

Input/output Format:

There is only one test case. In the first line input the first number , then in next line input another number.Display the result in another line

Sample Input:

30

12

Sample Output:

5

Explaination:

prime factors of 30: 2, 3, 5 and 12: 2, 3

so sum of common prime factors is 2+3=5

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?