Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2006-01-20 18:50:09

soorejmg
Member
Registered: 2006-01-20
Posts: 24

Find One

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????? eek

Offline

#2 2006-01-20 19:09:36

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Find One

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

#3 2006-01-20 23:44:49

soorejmg
Member
Registered: 2006-01-20
Posts: 24

Re: Find One

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...eekroflol

Offline

#4 2006-01-21 00:10:44

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Find One

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

#5 2006-01-21 00:20:47

soorejmg
Member
Registered: 2006-01-20
Posts: 24

Re: Find One

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

#6 2006-01-21 01:10:20

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Find One

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

#7 2006-01-21 03:40:06

soorejmg
Member
Registered: 2006-01-20
Posts: 24

Re: Find One

MathdIsFun .....are u getting any idea about it/????

Offline

#8 2006-01-21 03:43:24

soorejmg
Member
Registered: 2006-01-20
Posts: 24

Re: Find One

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

#9 2006-01-21 09:52:23

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Find One

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. sad


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#10 2006-01-21 17:11:52

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Find One

Also discussed here


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#11 2006-01-21 17:24:54

irspow
Member
Registered: 2005-11-24
Posts: 1,055

Re: Find One

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

#12 2006-01-21 20:45:43

Ricky
Moderator
Registered: 2005-12-04
Posts: 3,791

Re: Find One

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

#13 2006-01-21 21:01:07

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Find One

irspow wrote:

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

#14 2006-01-22 00:29:33

soorejmg
Member
Registered: 2006-01-20
Posts: 24

Re: Find One

Ricky wrote:

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

Board footer

Powered by FluxBB