Adrian

Posted on

# Scientists estimate less than 70! atoms in the observable Universe!

Did you know that scientists estimate less than 70! atoms in the entire universe?

This looks impossible but you can actually verify this statement pretty easily with the help of Google and a little bit of JavaScript.

# Step 1

Just google "atoms in the observable universe" and see the answer.

# Step 2

Use the codeguppy.com editor and copy and paste the following code snippet:

``````var p = 1n;

for(var i = 1n; i <= 70n; i++)
{
p *= i;
}

println(p);

``````

# Step 3

Compare the results from the previous steps! You'll see that the statement is accurate!

Note: This fun fact has been the pretext to introduce you working with Big Numbers in JavaScript (note the "n" suffix after the constants in the code above).

70! is such a big number that you cannot calculate accurately using regular numbers. Of course ... you don't always need precision when working with a such big numbers.

However, it is always important to estimate the size of your data structures when code. Otherwise you may run into interesting situations.

Big numbers are a pretty recent construct in the JavaScript language. If you want to calculate 70! in a classical way, without big numbers, just take a look at this code: https://codeguppy.com/code.html?m4AfgJmCABGNEvKlUNtM

For more fun facts and programming tips please follow @codeguppy on Twitter.

## Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.