Jump to content

A-B=C

Featured Replies

Alright, so I think I solved this algorithm, I call it the shrink ray, I got the idea from Minions. Pretty much with any number of A-B in binary, you can reverse engineer A and B from C alone knowing how many 1's and 0's there are for A and B.

 

For example:

 

1010 A (two 1's, two 0's)

-0101 B (two 1's, two 0's)

--------

0101 C

 

Note: I've only tested the condition for A>B, not negative numbers

Now you reverse engineer A and B from C, you know C is 5 and A and B are bigger, so you can have A=6 B=1, A=7 B=2, A=8 B=3, A=9 B=4, A=10 B=5, A=11 B=6, A=12 B=7, A=13 B=8, A=14 B=9, A=15, B=10. Now with all these conditions available, the only set that holds true with A having two 1's and B having two 1's are A=10 and B=5. So that's the solution. I think you can reverse engineer any A and B with C and the bits information on A and B.

 

If A and B are 32 bits each, it only takes 6 bits each to store the bit information since the largest possible sum is 32, so I think it's pretty good in terms of shrinking the size down, check the math for me will ya Strange?

Edited by fredreload

  • Author

it seems there is an exception when C is 0 where A and B can be anything, well that's the only exception I think

  • Author

Well it's easy to bypass this exception, since you only need one set of value, A or B, so set both bit count to zero(they might not be zero but this means A and B are the same) and set C to either A or B

Edited by fredreload

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.