# I don't understand the basics fully

#1

So what I don’t know is(Please describe in depth):

1. How to count in it like where the ones go eg: 5 has the same amount of digits as 6 but in different places, please describe for larger numbers like 401 and 402
2. for the “or”, "and, and “XOR” operations what if the numbers have a different number of digits?
3. How to count in a nutshell
That’s all thanks

#2

also how can a bit be on or off

#3

By being a `1` or a `0`. When a bit is set, it is on. Setting a bit means giving it a value of 1.

One primary concept to understand when learning binary is Number Bases and logarithms. By this math we can show that Octal 31 is the equivalent of Decimal 25.

Binary numbers are the only ones to enjoy the luxury of simple `on`/`off` states. Given any other number of states, `0` would only be one of them. With binary, `0` is the other one from `1`. Hence, set/not set.

``````>>> 031
25
>>> 0b11001
25
>>>
``````

Looking at the Octal, first…

``````3 * 8 ** 1 + 1 * 8 ** 0
=>  24 + 1  =>  25
``````

Now the binary,

``````1 * 2 ** 4 + 1 * 2 ** 3 + 0 * 2 ** 2 + 0 * 2 ** 1 + 1 * 2 ** 0
=> 16 + 8 + 0 + 0 + 1  =>  25``````

#4

I get the on/off now and the order of operations and so on but I have no idea what you mean by octal, does it mean 8 bit? Or does it mean something else? I’m still pretty clueless as to how binary works.
But thank you very much for your response.

#5

Yep an `octal` is eight bits. 8 bits is called a `byte` and computers use `bytes` to store numbers. So all numbers are represented using blocks of 8 bits. Small numbers would just take up 1 byte, and large ints take up to 4 bytes.

Have a google for “introduction to binary” and you should find some good resources like this one to learn a bit more.

#6

No, it has nothing to do with bits. It means number base 8.

``````Decimal      => number base 10

Octal        => number base 8

Binary       => number base 2
``````

Converting numbers from one base to another can be done with an algorithm, or it can be done mathematically using the simple rule…

``````log base a of x == log x / log a
``````

If you have not studied logarithms yet, then think in terms of exponents.

Eg.

``````1000 == 10 ** 3

log base 10 of 1000 == 3
``````

If we start with 1 and multiply it by 10, three times we get 1000. 1 * 10 == 10. 10 * 10 == 100. 100 * 10 == 1000.

That is in decimal. Now let’s try in binary…

``````0b1000 == 2 ** 3

log base 2 of 0b1000 == 3
``````

If we start with 0b1 (that is binary for `1`) and multiply by 2, three times, we get 8.

``````8 == 2 ** 3
``````

The exponents are the determiners of how many digits a number will have in any base.

``````10 ** 3  => 3 digits plus 1, 4 digits.

2 ** 3  => 3 digits plus 1, 4 digits.
``````

So, 2 ** 7 will have 7 + 1, or 8 bits. A bit is a binary digit.

Computers use switches that can be toggled on or off. Each switch represents a single bit. It is the architecture of electronics that gives us the binary connection.

Say we have 4 kilobytes of RAM (Random Access Memory). that chip will contain,

``````4 * 1024 * 8
``````

or 32, 768 switches. It takes a minimum of two transistors to make one switch. That means this chip has 65, 536 transistors. And that is just 4 KB. How many switches are there in 1 gigabyte of RAM?

Read up on Logic Gates to get more insight into the electronics side of this. In the meantime, keep working on how to convert number bases from decimal to binary, decimal to hexadecimal, and binary to hexadecimal (and vice-versa). You will be rewarded for your efforts.

#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.