2.557x10^23 atoms
The atomic mass of carbon is 12.0107. So the number of moles of carbon in the 51 mg diamond is
0.051 / 12.0107 = 0.004246 moles
Now multiply by avogadro's number (6.0221409x10^23) to get the number of atoms. Giving
0.004246 * 6.0221409x10^23 = 2.5571298x10^21
Rounded to a reasonable precision gives you 2.557x10^23 atoms