The gravitational attraction an object has on you depends on how much mass it has, and how far away you are away from it. If the mass is spherical, then the closest you can get to its center (without digging) is its surface. This means that the gravitational strength of a spherical star/planet depends on its mass and its density. The higher an object’s density, the smaller its radius, and the stronger gravity is on its surface.
Now suppose we spin our spherical world. If we are standing on its surface, we would have a tendency to fly off the world due to its rotation. The gravity is stronger than the centrifugal force, so we stay put. But if we could spin the world faster and faster, we would reach a point where the centrifugal force is equal to the force of gravity. Spin the world any faster, and we would fly off. This means that for a given density for a planet/star, there is a maximum rate of rotation. Any faster and it would fly apart. Put another way, if we measure the rotation of a planet or star, we know its minimum density.
Very roughly, we can calculate that density in grams per cubic centimeter by taking 140 million and dividing it by the square of an object’s period in seconds. So for the Earth, the period is 24 hours or 86,400 seconds. Plug that into our equation and we get a minimum density of about 0.02 g/cc. The Earth’s real density is about 5 g/cc, well above that minimum.
Pulsars are kind of like cosmic light houses. As they rotate they sweep out a beam of radio waves from their magnetic poles. If those poles are pointing in our direction, we can hear each rotation as a pulse.
The fastest pulsars have a rotational period of about 1/1000th of a second. Plug that into our equation, and you get a minimum density of about 100 teragrams/cc. Thats 1 with 14 zeros after it. 100 trillion grams per sugar cube volume. That density is unimaginably high, but it also happens to be about the density of the nuclei of atoms.
So pulsars are as dense as atomic nuclei, only several kilometers in diameter. We call them neutron stars.