Ask HN: How would you store a number with a 10^6 digits and all numbers

https://news.ycombinator.com/item?id=4947749
by sycren • 14 years ago
7 7 14 years ago

Very large numbers have a few applications, the largest prime numbers in the world have millions of digits [1]. On stackoverflow, one solution for storing a million phone numbers is to use a trie. [2][3] Another way would be to use alphabets as a method of encoding the numbers. For example if all the unicode characters were used in a string we could have 110,000^(String length) [4] Here Pi is displayed to a million digits [5]. As a unicode .txt this is 2MB. If I was to store every combination of number from 0 to this number it could prove to be impossible. How would you suggest storing such large numbers?

  [1] http://primes.utm.edu/largest.html
  [2] http://stackoverflow.com/questions/5262465/storing-1-million-phone-numbers
  [3] http://en.wikipedia.org/wiki/Trie
  [4] http://en.wikipedia.org/wiki/Unicode
  [5] http://www.piday.org/million.php

Related Stories

Loading related stories...

Source preview

news.ycombinator.com