Binary.
While many people relate it with computers, which is true, for binary is used in computers, but what much people don't understand it's that binary's actually simpler than you may think.
The numbers go in this sequence:
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
...
Understand the pattern? Here's a more easier way to express it. We'll use 0's as no's and 1's as yes's. If the sum of a number (including only this numbers, and no number being used more than one time) includes any of this numbers, we'll put a 1 (yes). Else, we'll put a 0 (no)
8 4 2 1 Number
0 0 0 1 1 0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
1 0 0 1 9
1 0 1 0 10
1 0 1 1 11
1 1 0 0 12
1 1 0 1 13
1 1 1 0 14
1 1 1 1 15
But another interesting thing about binary is that you can do most mathematical operations just fine by only modifying the algorithm a little bit.
For example, adding 1+1 in the binary modification will give you 10, which translated into the decimal system, is actually a truth: 1+1=2. And 1+1 it's not the only thing you can add in binary. We can also try:
Binary addition: Decimal translation: 101+110=1011 5+6=11
1100101+1110001=11010110 101+113=214
And if you can add, why shouldn't you subtract?
Binary subtraction: Decimal translation: 1000001-1=1000000 65-1=64
1010101010-101010101=101010101 682-341=341
You should try to modify the addition and subtraction algorithms so you can add and subtract in binary, but can you modify the multiplication algorithm to binary? Yes!
This are some examples of binary multiplication:
Binary multiplication: Decimal translation: 10x10=100 2x2=4
11010x11010=1010100100 26x26=676
And division:
Binary division: Decimal translation: 110÷10=11 6÷2=3
1010100101010100101010÷10=101010010101010010 2774314÷2=173394
And of course you can try powers, after all they're a kind of multiplication. So next time anyone says to you that binary is hard, you'll have something to explain.
-The Roaring Thunder
En lógica booleana el operador XOR es usado para realizar sumatorias.
ResponderEliminarLa tabla de verdad del XOR es:
0 XOR 0 = 0
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 1 = 0