FunctionRacerProblemsRace

Number of Common Factors

BeginnerMathPython, JavaScript, TypeScript, Java, C++

Return how many positive integers divide both a and b.

Example 1

a 12
b 6
returns 4

1, 2, 3 and 6 divide both.

Example 2

a 25
b 30
returns 2

1 and 5.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems