You are not logged in.
Pages: 1
U have two numbers ..u must find a method to find a third number from this two numbers such that afterwards only the 3rd number is provided u should get back the first two number..One more thing to easy the work...the two numbers is in limit 0 to 255 .CAN ANY ONE?????
Offline
C = A + B×256
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
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
HI..It was nice...But would u mind me putting one more constrain??
The NEW NUMBER FORMED C SHOULD NOT BE GREATER THAN 255.CAN U?
TRY IT.Best of LUCK...
Offline
Not if they must be whole numbers (I assumed whole numbers by the nature of your question).
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 physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...............The C being real number is not atall acceptable..U CAN DO ANY OPERATION LIKE IN BINARY OPERATIOBS AND CONVERTION ALL>..Can any one.....Its very challenging...
Offline
I would say that with those conditions, it's impossible.
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.
Why did the vector cross the road?
It wanted to be normal.
Offline
MathdIsFun .....are u getting any idea about it/????
Offline
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?
Offline
If there are only 256 values for C, then you can only reconstruct 256 cases. If A and B can have 256 independent values each, then there are 65536 cases (as mathsy said) and I so it cannot be done.
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
Also discussed here
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
Poor MathsIsFun has to go running around stitching together cross-forum forays by posting links to far flung fragments of desperation.
I, for one, applaud your tenacity.
I am at an age where I have forgotten more than I remember, but I still pretend to know it all.
Offline
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.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Offline
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!
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
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
Offline
Pages: 1