# Interesting idea for encoding small numbers efficiently. - Journal of Omnifarious

## Nov. 17th, 2008

### 03:30 pm - *Interesting idea for encoding small numbers efficiently.*

I'm trying to think of a way to use a set of prime numbers to assist in efficiently representing a series of arbitrary integers.

My first thoughts about this involve defining a set of *n* primes *P* in conjuction with the set of *n* values *V* such that *P _{i}* is the smallest prime greater than

*V*for all

_{i}*i*from 1..

*n*. Basically I was thinking of using a set of primes as a sort of basis vector. But now I'm not sure I can make this idea work.

Anyway, the idea is to encode several small values, each of which may take from 2-8 bits to represent in less than a byte or two if the total bits of all the values are less than 12 (bonus points for using only a byte of the total bits are less than 7) and less than 3 bytes if the total bits are less than 20.

**Current Location:**1500 Dexter Ave N, 98109

**Current Mood:**contemplative