\frac{A}{B}=\frac{k\cdot(A, B)}{p\cdot(A, B)}=\frac{k}{p}