Most efficient method of finding the number of common factors of two numbers using Golang : I have two numbers for example the numbers are 12 and 16.

> factors of 12 are 1, 2, 3, 4, 6, 12
> 
> factors of 16 are 1, 2, 4, 8, 16
> 
> common factors of these two numbers are 1, 2 and 4.

So the number of common factors are 3. I need to build a Golang program for finding the number common factors of two numbers. But the program should be efficient and with minimum number of loops or without loops.