4 ms·
If you used small chunks (say, up to four bytes) you could just have a lookup table storing all the indices. Or - what a genius idea! - we could use Pi itself
by sqrt17 12y ago
If you used small chunks (say, up to four bytes) you could just have a lookup table storing all the indices.
Or - what a genius idea! - we could use Pi itself as a lookup table and use the sequence of n bytes at that position of pi as an implicit lookup table.
- lubos 12y agoThere are 4,294,967,296 possibilities in 4 bytes. To store a number in range of 0 to 4,294,967,296 - you will need exactly 4 bytes.
- sqrt17 12y agoNot all 32bit sequences can be found in the first 4,294,967,296 binary digits of pi. Hence you will either need more then 4 bytes to encode 4 bytes in a pi position or a lookup table to fit the 4,294,967,296 numbers, some of which will be substantially larger than 4,294,967,296, into 4,294,967,296 slots.
- delinka 12y agoTo save us from searching in the number space after 4.3-ish billionth slot, we could just store the sequences that we didn't find in that part of pi. I propose a bit used to indicate whether the current sequence is a pi-sequence or just raw data.