I find numbers extremely fascinating even though I am usually horrible at math I enjoy logical functions and algorithms and especially data structures (probably why I love object orientated languages so much.) Recently I was playing with some concepts of on demand generated websites that could generate thousands of unique pages utilizing very few lines of code. There are lots of ways to do this, but at the same time I felt one of the goals must be to also generate on those pages some kinds of useful and/or meaningful information.

Within a couple of days I had a little less than thousand lines of code and about 5 web page templates put together to generate every prime number between 1 and 9,223,372,036,854,775,807. That is nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred seven.

It’s important because it’s the limiting factor of a 64 bit integer. You’ve probably heard that computer code is really 0’s and 1’s, that’s right. In binary we count using only the digits 0 and 1 instead of 1 through 10 but you add and carry exactly the same.

0001 = 1 0010 = 2 0011 = 3

but when you have 63 of these all set to 1

111111111111111111111111111111111111111111111111111111111111111

it comes out to our magic number of 9,223,372,036,854,775,807.

Why not 64 digits? Because the last bit in PHP is reserved for indicating positive or negative. Some languages such a C allow you to extend the number by sacrificing negative numbers, this is referred to as an “unsigned integer”. But PHP does not support unsigned.

So I put this website together to try and extrapolate interesting information about numbers at IntegerNumber.com, things such as is it a prime number, what divisors and factorization values does it contain, simple hash codes and other base representations besides the standard base 10 and binary.

Just imagine however if Google or another search engine was to try and crawl and index every one of those pages. If Google could crawl 1 page a second, it would take 292,277,506,246 years to crawl every page. That is 20 times the current age of the universe. Also at roughly 1k bits of information per page the storage capacity required would be…my calculator broke…let us say lot 🙂

So to be nice to my hosting provider I decided to limit it to the integer 2,147,483,647 which is max for a 32 bit integer with a length of 31 binary 1’s. Am I not merciful.

## Recent Comments

## Archives

## Categories

## Meta