C = A + B×256

Dnt u have any idea like in puzzles some tricks are there to find out number by special operations all....any idea like that in this case?

I can prove through the use of the pigeon hole principle, that it is not possible if the function must be onto (valid for every value of C). Once you prove something impossible, there are no such tricks.

please proove it

]]>Poor MathsIsFun has to go running around stitching together cross-forum forays by posting links to far flung fragments of desperation.

I may have created a loop!

]]>C = A + B×256

Nicely done. I'm assuming you, MathsIsFun, know why this works, but for an explanation on why it works, all you need to know is bit shifting. Bit shifting is the way all multiplication works. If you shift all the bits in a number:

01000100

10001000

By one place, you multiply it by 2. If you do so by 2, you multiply it by 4. 3, 8. 4, 16. And so on. There are 8 bits in a char (which is [0, 255]) and 2^8 = 256. So multiplying it by 256 shifts it 8 bits. So for example:

00000000 01000100 (space is there just for readability)

Becomes:

01000100 00000000

Adding another 8 bit (again, [0, 255]) value:

01000100 00000000

+00000000 01100100

-------------------------

01000100 01100100

And thus, it is just like putting each number side by side.

Dnt u have any idea like in puzzles some tricks are there to find out number by special operations all....any idea like that in this case?

I can prove through the use of the pigeon hole principle, that it is not possible if the function must be onto (valid for every value of C). Once you prove something impossible, there are no such tricks.

]]>I, for one, applaud your tenacity.

]]>There would be 65536 different combinations for A and B (Yay for having powers of 2 committed to memory!), but only 256 different possibilities for C.

There's probably some trick that I'm missing though.

]]>If C can be a real number, but A and B are whole numbers:

C = A/256 + B

B = int(c)

A = (C-B)×256

The NEW NUMBER FORMED C SHOULD NOT BE GREATER THAN 255.CAN U?

TRY IT.Best of LUCK...

]]>To get A and B from C:

B = int(C/256) ...note: int() means take only the integer, or whole number, part

A = C - B×256

Try it:

A=52, B=2

C = A + B*256 = 50 + 2×256 = 564

C = 564

B = int(564/256) = int(2.203125) = 2

A = C - B×256 = 564-2×256 = 564-512 = 52