Go back to previous page
Forum URL: http://www.cut-the-knot.org/cgi-bin/dcforum/forumctk.cgi
Forum Name: College math
Topic ID: 245
#0, Binary system
Posted by karatedude5 on Apr-12-02 at 09:27 PM
I am new at the binary system. I know that "1" is on "0" is off. The base is 2. I read on a site that

A= 01000001
B= 01000010

I need to know if this is true. Also i need to know how you use the base number to find out binary numbers



#1, RE: Binary system
Posted by Laocon on Apr-13-02 at 07:19 AM
In response to message #0
Binary is pretty simple.

Read from right to left the numbers in order of size (lowest -> highest).

The first digit represents 1s
The second digit represents 2s
The third digit represents 4s
The fourth digit represents 8s
....

and so on doubling each time. You then add up how many 1s, 2s, 4s, 8s, ... to convert to decimal.

To convert decimal to binary, what I do is use a system akin to "Russian Mathematics". Rewrite the number as x * 1, then halve one side and double the other...
Then check the odd numbers in the right hand column and rewrite :)

EG To convert 72 (decimal) into binary,

72 = 1 * 72
= 2 * 36
= 4 * 18
= 8 * 9
= 16 * 4 (ignoring the 1/2)
= 32 * 2
= 64 * 1

Then check the odd numbers (9 and 1) Then rewrite odd numbers as 1s and even as 0s. eg from top to bottom if the number is odd on the right hand side I put 1, and 0 for even: 1001000 (64 + 8)

The questions you pose give:

A= 01000001 = 65
B= 01000010 = 66

And I am not sure about that...


#3, RE: Binary system
Posted by Gill in the UK on May-18-02 at 10:32 AM
In response to message #1
re:- the binary system

128 64 32 16 8 4 2 1

1 0 1 0 0 1 1 1
______________________

______________________

so what is this number ?

lets look at it once more. In easier language for you .

There is a ( 1 ) under the binary items. Some have a zero.

There is 1 under the 128 = 128
there is 0 under the 64 = 0
there is 1 under the 32 = 32
there is 0 under the 16 = 16
there is 0 under the 8 = 0
there is 1 under the 4 = 4
there is 1 under the 2 = 2
there is 1 under the 1 = 1
------------
-------------

so, add the right hand column together and what do you get ?

I can tell you its 183.

in binary , it would be written as 10100111

------------------------------------------------

a very easy way of doing binary is as follows.

001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
111 = 7
1000 = 8
1001 = 9
1010 = 10

remember the intitial numbers in binary 128 64 32 16 8 4 2 1


I hope this helps some. Its really easy if you remember to double the columns with the lowest number on the right..

Gill


#4, RE: Binary system
Posted by Michael Klipper on Jul-27-02 at 02:45 PM
In response to message #1
The original problem-poser needs to clarify what they mean by
A = 01000001.
Obviously, a letter (unless it is a variable) does not equal a number.

HOWEVER, I think that what is implied in the question is that the CODE FOR A THAT COMPUTERS USE has the representation 01000001. This code is called ASCII (American Standard Code for Information Interchange), and it uses the values 0-255 to represent many characters. Another similar system is called Unicode, which uses 32-bit numbers to represent a wide range of international characters. I think that ASCII and Unicode agree on the first 256 characters.

So, with this idea in mind, it is true that 'A' gets the ASCII value of 65. In binary, this is written as 01000001, when the number is padded to 8 bits. Note that 'a', lowercase, has the ASCII value 97, represented as 01100001. (The capital and lowercase letters are essentially different characters with different codes.) Also, 'B' has the value of 'A' + 1, 'C' has the value of 'A' + 2, etc.
---------------
Once you get more familiar with base conversions, you'll find there's a very easy way to find the ASCII values for many familiar characters. It uses base-16 called hexadecimal.

Essentially, the number characters (0-9) start at 30 in hex, or 48 in decimal.
The uppercase characters start just after 40 in hex, or 64 in decimal.
The lowercase characters start just after 60 in hex, or 96 in decimal.


#2, RE: Binary system
Posted by RicBrad on May-15-02 at 06:40 PM
In response to message #0
The method I use to convert to a different base "b" (e.g. b=2 for binary) is using remainders and integer division.

If you use % for remainder (mod) and / for integer divison:
so 67 % 3 = 1 means "the remainder you get when dividing 67 by 3 is 1"
and 67 / 3 = 22 means "67 divided by 3 is 22 if you ignore remainders"
Then the most general method of converting is this:

Take your intial number N. Define the function f that takes a number and returns its digits, base b.
The first (least significant) digit in base b is (N % b).
The subsequent digits are given in the same way using f(N / b)
This is a recursive definition. Lets have an example:
in base 2 using , to separate the digits:
f(65) = f(65/2),(65%2)
= f(32),1 = f(32/2),(32%2),1 = f(16),0,1 = f(16/2),(16%2,0,1
=...=f(0),1,0,0,0,0,0,1
so f(65) = 01000001

and in answer to your first question the ASCII code for "A" is 65. So in the right context
A=01000001
but remember that this is simply a way of interpreting numbers as letters. The number 65 does not inherently equal "A".