[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
Bits quick question?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /sci/ - Science & Math

We have 7 colors of the rainbow and 100 numbers, each color can be associated with a number between 0 to 100 or 1 to 100.

For example (BLUE, 48)

How many bits do we need to represent all possible combinations?

For 7 colors we need 2^3=8
But for the 100 numbers do we need 2^7=128 (which encompasses 100).

Do we need 128 + 8 bits?
Do we need 128 bits alone because 128-100-7=21 extra bits
Do we need less than that?

Thank you.

pic unrelated
>>
Not sure I really understand your question but ill respond regardless
2^3 for 8 combos.. thats 3 bits
2^7 = 128, so 7 bits there

you could to 10 bits, first 3 for color, next 7 for numbers.

does this make sense, if not reword your question so I can understand it better.
>>
you have 7 colours and 100 numbers
the number of possible combinations is 700
[math]2^9 < 700 < 2^{10}[/math]
you need 10 bits.

what the fuck is this for btw?
>>
>>7795796
it's for a class I'm taking intro to computer science
and thank you
>>7795792
basically I need to represent a pair made of (COLOUR, NUMBER)
there are 7 colours and 100 numbers (from 1 to 100) how many bits do I need to represent all possible combinations
>>
>>7795800
you can do it both by just counting up to 700, or by using 3 bits for the colour and 7 for the number, as you (and >>7795792) said.
the latter is probably more intuitive, but the former is better if you want to use the leftover address space to store additional information.
>>
>>7795814
Thank you