The sample contains 38.7 g of Ca, 19.9 g of P, and 41.2 g of O as the proportions show.
Then we can calculate the number of moles of each component (n = m/atomic mass).
The number of moles of Ca = 38.7/40.078 = 0.96 mol.
The number of moles of P = 19.9/30.97 = 0.64 mol.
The number of moles of O = 41.2/15.99 = 2.75 mol.
Now, we can get the molar ratios of different components (Ca, P, and O) in the sample by dividing the number of moles of each component by the lower number of moles, that we should divide the number of moles by (0.64).