For two and a half million years, the most infamous of predators, Tyrannosaurus rex, slowly stomped its way around what is today North America's western coast.

Scientists have now come up with an estimate for the total number of T. rex that ever existed: around 2.5 billion (yes, billion).

This may sound like a lot - and it's certainly more than you picture when watching them stalking around solo in films such as Jurassic Park. But to put it into perspective, by some calculations it's estimated that more than 100 billion 'modern' Homo sapiens have called Earth home at some point, and that number is still getting bigger by the year.

While knowing how many individuals once lived of any particular long dead species may not mean much in and of itself, this type of exercise can provide researchers with some insight into past ecologies and species completely missing from the fossil record.

A team of researchers led by University of California paleontologist Charles Marshall, chose T. rex as their subject because these giant beasties are the most well understood dinosaur.

They used Damuth's Law, an ecological equation that describes the relationship between body size and population density, which was derived by studying living species. In rough terms, the larger the individual animal, the lower its population density, with some weighting also given to trophic level (where they lie on the food chain) and their physiology.

"Establishing [T. rex's] physiology has proven challenging," the team wrote in their paper. This measure is important because among living species those with slower metabolisms can sustain larger population densities.

Whether dinosaurs were warm or cold blooded is a hotly debated topic, so reviewing the scientific literature the team decided to assume a physiology somewhere in between - midway between a large mammalian carnivore and that of a large land lizard like a Komodo dragon.

Using the fossil record the team obtained a mean weight of 5,200 kilograms (11,500 pounds) for the species. After all the number crunching the researchers arrived at the estimate of 20,000 individual T. rex living at any given time during their existence.

Based on estimates involving their growth rates and sizes, the team also determined their population density, a figure that roughly equated to 3,800 of these fearsome predators stalking an area equal to California.

Previous estimates on dinosaur abundance based on fossil finds at Hell Creek Formation suggested an abundance level greater than expected from a typical predator, suggesting among other things that T. rex adults did not compete with their juveniles for the same food sources. This has since been backed up by more research.

And while T. rex appears to have been quite common in this location (this is where most of their fossils have been found), Triceratops were the most common species represented in the fossil record, so it would be interesting to see estimates of their total abundance in comparison.

Given how many assumptions have been made to obtain these abundance estimates, they of course have high uncertainty levels.

"Nonetheless, our capacity for inferring population sizes of extinct taxa greatly exceeds what [was] thought possible more than 75 years ago," Marshall and colleagues wrote. "This capacity has been enabled by the discovery of many more fossils and the ability to establish growth and survivorship curves from age and body mass estimates."

These estimates suggest only one per 80 million of them have been recovered as fossils - highlighting just how precious and rare such remains really are.

Marshall and colleagues hope this technique can hint at how rare, short lived or restricted a species is likely to have been to have escaped being fossilized for our discovery.

This research was published in Science.