I am reading chapter 31 of Introduction to Algorithms (CRLS) and I encountered some difficulties while solving 31.2-9. I managed to prove the first part of a problem, but I can't prove the generalized version.
This is the problem statement:
Prove that n1,n2,n3, and n4 are pairwise relatively prime if and only if gcd(n1n2,n3n4)=gcd(n1n3,n2n4)=1. More generally, show that n1,n2,...,nk are pairwise relatively prime if and only
if a set of ⌈log(k)⌉ pairs of numbers derived from the ni are relatively prime.
Proof of the first part: gcd(n1n2,n3n4)=1 means that n1n2 and n3n4 doesn't have any common factors, so gcd(n1,n3)=gcd(n1,n4)=gcd(n2,n3)=gcd(n2,n4)=1. The same is for the second equation so, gcd(n1,n2)=gcd(n1,n4)=gcd(n3,n2)=gcd(n3,n4)=1
Answer
Hint: Assume that we have k positive integers a0,…,ak−1 and k≤2m. For any j such that 1≤j≤m, we define fj(m) as the value of the (j−1)-th bit from the right in the binary representation of m, then take:
N(j)1=∏k:fj(k)=1ak,N(j)0=∏k:fj(k)=0ak
and compute Gj=gcd(N(j)0,N(j)1). If Gj=1 for any j in the range [1,m], the original integers are pairwise coprime, otherwise they are not. And obviously m≈log2(k).
This construction is kindly stolen from Hadamard matrices.
No comments:
Post a Comment