[SOLVED] Need help...is there an equation to solve this easily?

I'm new to this site, and I apologize if I've put this question in the wrong forum, but I really wasn't sure where it should go. This is not for a class.

...

So, right now I'm stuck with guess & check for this, unless someone knows a formula I can use.

I have the following equation:

A1+2B+C4+D8+E16+F32 = X

X is given. It is one value out of the set {1,2,3...63)

A,B,C,D,E,F can only be 0 or 1.

Is there a way to solve for A through F? There is only one right answer per value of X. For example, If X=1, then A=1 and B through F=0. Or, If X=3 then A=1, B=1, and C through F=0.

Having an equation to solve this will make this a lot simpler for me than creating a table of all 63 possibilities (64 if you include X=0).

Thanks!