# Arduino Forum

## Using Arduino => Programming Questions => Topic started by: lemmings on Mar 15, 2019, 12:30 am

Title: Cramming Long Sequences of Numbers into Small Memory
Post by: lemmings on Mar 15, 2019, 12:30 am
Hey Everyone,

I have 366 bytes of EEPROM memory left on my board and I want to ideally cram 60+ sequences of 18 numbers.  Each number in that sequence is a value between 0-127.  Using hexadecimal I can get 40 sequences of 18 numbers, but is there a way to get even more?

The values are not always 3 digit, but they can be that high.  Anyone know of any methods that could solve this problem?

Thanks!
Title: Re: Cramming Long Sequences of Numbers into Small Memory
Post by: gfvalvo on Mar 15, 2019, 01:03 am
Let's look at what you have to work with:

366 bytes * 8 bits / byte = 2928 bits available

If your numbers can take any value between 0 and 127 (and no compression is possible), then the absolute most efficient way to pack them is to use 7 bits per number. So:

60 sequences * 18 numbers / sequence * 7 bits / number = 7560 bits required.

Doesn't promising, does it?