Easy (but aproximate) way to determine number of atoms in solar system planets
is to divide mass of a planets by mass of an atom.
Masses of the planet are easy to find, e.g. here:
Mass of the 'average' atoms is ranging from H (hydrogen) to let's say Fe (Iron)
and Uranium U and are listed here
It ranges from 1 to 238 times mass of proton
proton mass = 1.67262158 × 10-27 kilograms (google search term)
Since most of the mass is in the Gas Giant planets Jupiter, Saturn,
Uranus, and Neptune, as the following graph indicates.
It is possible to take 'average mass of atom' to be that of H ,
( that is of a proton ).
More accurate determination would separate 'inner planets'
called the "terrestrial" planets because of their proximity to Earth
("Terra" in Latin) and their similarity as solid bodies with compact,
The question of the number of atoms in the universe , or just a galaxy,
would be much more complex, since there are open questions, about the
size of the universe, and so called 'dark mass'.
Sir Arthur Stanley Eddington, ( 1882 ? 1944) an astrophysicist of
the early 20th century was first to try to estimate 'number of atoms
in the universe.
It is called Eddington_number and not taken seriously any more:
I believe there are 15,747,724,136,275,002,577,605,653,961,181,555,468,044,717,914,527,116,
709,366,231,425,076,185,631,031,296 protons in the universe and the
same number of electrons." So wrote the English astrophysicist Sir
Arthur Eddington in his book Mathematical Theory of Relativity (1923)
which is .5* 3.149544...×E79
No more respected are some more recent speculations
I did this calculation, which was relatively simple. You take, first
of all, the observed density of matter in the universe, which is
roughly one hydrogen atom per cubic meter