Suppose N = 8. There are 4 pairs (1,8),(2,8),(4,8),(8,8) whose LCM is 8. If N = 6. Then there are 5 pairs (1,6),(2,6),(2,3),(3,6),(6,6) whose LCM is 6. Now I want to know how to find the number of pairs quickly?
Asked
Active
Viewed 724 times
0
-
YOUR SHIFT KEY IS STUCK – Uwe Keim Sep 18 '16 at 13:51
2 Answers
1
The question "Pairs of numbers with at given LCM" at math.stackexchange.com gives the formula
((2e1+1)(2e2+1)...(2ek+1)+1)/2
where e1, e2, ... is the exponents for the unique prime factors of n
for this number.
i.e.
8 = 2^3 has ((2*3+1)+1)/2 = 4 such pairs,
6 = 2^1 * 3^1 has ((2*1+1)(2*1+1)+1)/2 = 5 such pairs, and
60 = 2^2 * 3^1 * 5^1 has ((2*2+1)(2*1+1)(2*1+1)+1)/2 = 23 such pairs.
0
You can refer to a similar question over here
https://math.stackexchange.com/questions/4152/pairs-of-numbers-with-a-given-lcm
basically if n=(p1^e1)(p2^e2)...(pk^ek) where pi is prime for 1<=i<=k
then the solution would be ((2e1+1)(2e2+1)...(2ek+1)+1)/2