Saturday, October 28, 2017

algorithms - GCD and LCM of three numbers



Given two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G and lcm(x, y, z) = L? gcd(x, y, z) means the greatest common divisor of x, y and z, while lcm(x, y, z) means the least common multiple of x, y and z. Also, (1,2,3) and (1,3,2) are two different solutions, while (1,2*,2) and (1,2,2*) are the same solution.(* is just a symbol) Are there any ideas about this? Thanks in advance!


Answer



Let's write x=ni=1paii, y=ni=1pbii, z=ni=1pcii, where the pi are the primes that are factors of at least one of x,y,z.


Then gcd(x,y,z)=ni=1pmin(ai,bi,ci)i and lcm(x,y,z)=ni=1pmax(ai,bi,ci)i.


Now, suppose that n=1 for simplicity. Then the number of (x,y,z) with gcd pq and lcm pr is just the number of triples (a,b,c) with minimum q and maximum r. If r=q this is just 1, while if $q

So define f(s)=0 if s<0, f(0)=1, and f(s)=6s if s>0.


Now let G=ni=1pqii and L=ni=1prii. Then one can show that the number of triples with gcd G and lcm L is ni=1f(riqi)


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection f:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...