How in the hell do you divide by 7 using nothing but--
~, ^, >>, <<, &, |
-- In a set algorithm. I'm stumped.
I've tried mapping out different numbers dividing by each other... it didn't work.
I would map out a number subtracting from the other to see if there is some kind of pattern. I thought there was, but I think it varies based on whether the number is odd or not.
It's also hard to be accurate if the divisor being a prime number, odd number or even number matters.
This isn't required for anything. I just want to know how to think in the right direction to approach this.
If needed I'll write out what I've tried.
Edit: Might as well do it--
First: Thought that every number has a set pattern for division so I tried several tests.
15 / 3 = 5
1111 = 15
/ 0011 = 3
----------
0101 = 5
Pattern(theory, from the left) -> bitAnd, bitXor || bitIor, bitXor, bitAnd || bitIor
Still too many unknowns and possibilities with the potential "others" so I tried again with smaller numbers
8/2 = 4
1000 = 8
/ 0010 = 2
------------
0100 = 4
Pattern(theory, from the left) -> bitAnd, ???? || ~result, bitAnd, bitANY
Fairly inconsistent.
From there I was just about to stop, but I realized that it may be possible that numbers used for division that are the result of n continuous binary digits can be resolved to a pattern--
SUM (n-> a real number): 2^n
[1, 3, 7, 15, 31, 63, 127, 255, ...]
63 / 7 = 9
111111 = 63
/ 000111 = 7
------------
001001 = 9
Pattern(theory, from the left) -> bitAnd, bitAnd, bitXor || bitIor, bitXor, bitXor, bitAnd || bitIor
These results are fairly good, but semi-consistent with the first result.
Then again there probably couldn't be a set result since numbers will vary in length.
I believe that--
*There must be some "knock-off" determinant. Basically the length (or value) of the resultant number must be some binary function of the initial number and the divisor.
*That there most likely is a pattern but I'm just not seeing it. It could be some kind of circular-pattern dealing with the bit operations (for all real values).
This is just a hunch without any thorough research. I think I'll try continuously subtracting numbers to see if there is some kind of pattern.