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

You are not logged in.

## #1 2006-01-21 17:50:09

soorejmg
Member

Offline

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

## #2 2006-01-21 18:09:36

MathsIsFun

Offline

### 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

## #3 2006-01-21 22:44:49

soorejmg
Member

Offline

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

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

MathsIsFun

Offline

### 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

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

soorejmg
Member

Offline

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

## #6 2006-01-22 00:10:20

mathsyperson
Moderator

Offline

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

## #7 2006-01-22 02:40:06

soorejmg
Member

Offline

### Re: Find One

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

## #8 2006-01-22 02:43:24

soorejmg
Member

Offline

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

## #9 2006-01-22 08:52:23

MathsIsFun

Offline

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

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

## #10 2006-01-22 16:11:52

MathsIsFun

Offline

### Re: Find One

Also discussed here

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

## #11 2006-01-22 16:24:54

irspow
Power Member

Offline

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

## #12 2006-01-22 19:45:43

Ricky
Moderator

Offline

### 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..."

## #13 2006-01-22 20:01:07

MathsIsFun

Offline

### 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

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

soorejmg
Member

Offline

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