We covered compression/encoding/decoding of data streams very briefly last lecture and I had an odd idea: Let's say I have a stream of random 8-Bit numbers. Now the probabilty to encounter each number is 1/256. If I prime factorize each number though I get a stream of prime numbers where I can calculate the probabilty of encountering a specific prime number by looking at how often it appears in all prime factorizations of all 8-Bit numbers. Here's a couple of issues straight away:
- 0 and 1 are special cases, they dont have a prime factorization per-se
- the transform is not invertible, you'd have to use seperation symbols
One way to "solve" both issues is to include 1 as a prime number and encode a number x as a prime factorization of number (x + 1) which allows for 0 and 1 and still fits into 8-Bits because the largest 8-Bit prime is 251. The 1 at the beginning of each prime factorization also serves as a separation symbol.
Could I use this way to somehow ("efficiently") encode a random stream of data?