Hi,

In a certain system we are left with only 6 bits, which can store a no. of range 0 to 63.

We want to store two numbers each ranging from 0 to 12, which will take 4 bits each.

Does anyone know of any algorithm that can store these two 4 bit number in optimized way together into 6 bits.

I initially thought of old Birth date trick:

*1.Ask your friend to multiply the number of his month of birth by 5.*

2.To this add 6.

3.Now,multiply by 4.

4.Add 9.

5.Multiply again by 5 and add to it his date of birth.

6.Ask him/her to subtract 165 from this and tell the answer.

The last two digits of this number will give you the date and the first 1 or 2 digit/s give the month.

May be some combination of XOR/AND/OR operation can compress it into 6 bit.

Any weird working idea is welcome.

Thanks in advance.