Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 60

Hi;

How to convert:

I. Decimal to Binary and vice versa

*Last edited by Amartyanil (2016-02-05 20:24:39)*

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Hi Amartyanil;

By hand or by computer?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 60

Hi bobbym;

By hand

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Not even a calculator?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,018

You don't need a calculator for that.

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Hi;

Maybe for very small numbers but everything is easier when you have a little computing power.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 60

Hi bobbym;

First tell it by hand; then a calculator

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

The way I do it is by making a little table of powers of 2.

2^0 = 1

2^1 = 2

2^2 = 4

2^3 = 8

2^4 = 16

2^5 = 32

2^6 = 64

2^7 = 128

Now supposing we want to change 105 from binary to decimal. We get the closest power of 2 that is smaller or equal. We see in the above chart that it is 2^6 = 64. So put a 1 and subtract 105 - 64 = 41.

Now just go down the line does 2^5 fit in 41? Yes it does so add a 1 next to that 1.

11 and say 41 - 32 = 9

2^4 is larger than 9 so put a 0 next to that 1.

110

2^3 is smaller than 9 so put a 1

1101 and say 9 - 8 = 1

2^2 is larger than 1 so put a 0

11010

2^1 is larger than 1 so put a 0

110100

2^0 is exactly equal to 1 so put a 1

1101001 and say 1 - 1 = 0

We are done.

105 = 1101001 in binary

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 7,763

hi Amartyanil

If I have to do this by hand, here's the method I'd use for any number base.

Step 1. work out the column headings for that base.

Step 2. Starting with the biggest of these, subtract as many times as possible, then

Step 3, 4 etc continue with the lower powers until I'm down to units.

eg. Change 1123 into base 8

Step 1 the headings are 1, 8, 64, 512, .... I can see by inspection that 512 is as high as I'll need to go.

Step 2. 1123 - **2***512 = 99 so the number in the '512' column will be **2**

Step 3. 99 - **1***64 = 35 so the number in the '64' column will be **1**

Step 4. 35 - **4***8 = 3 so the number in the '8' column will be **4**

Step 5. As my remainder is now less than 8 the number in the 'units' column will be **3**

Final answer 1123 in base 10 is 2143 in base 8

Screen shot below shows the steps more neatly and how I checked that I'd got it right.

And here's a quick way to change that to binary.

In binary the first three columns are 4, 2 and 1

So you can change each octal digit into a 3 digit binary number thus

2143 becomes 010 001 100 011 and there's the binary version.

check 1 + 2 + 32 + 64 + 1024 = 1123

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Hi all;

Or as the Russian do?!

To change 530 to binary.

Make this grid:

The first column was created by dividing 530 by 2 and if there was a remainder ignoring it. The second column was created by the rule if the number next to it is even put a 0, if odd, put a 1.

Now start from the bottom

530 decimal = 1000010010 binary.

Lets do another one.

11571 decimal = 10110100110011 binary

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 60

Hi bobbym;

In my book of Computer Science(Now I am in 7th Grade), the Russian method is taught, i think it is quite easier.

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

They are very clever programmers. So you are in the 7th grade now, I am looking forward to seeing more of you.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

What is the Indian way?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Me or him?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

You or him what?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Are you asking me or Amartyanil?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

Anybody who can answer will do

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

You should be able to answer?!

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

No, I do not know the Indian way to convert Decimal to Binary. What is it?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

I do not know their exact way either but I am sure they are using one of the methods that everybody else does.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

I am an Indian. I can usually convert small numbers inside my head. If the numbers are large, I use a computer.

I also have an awesome wiki on bit hacks. Have you seen it?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

I did not even know about it. Where is it?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,764

Good ole Hamming, nice page!

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

Thanks!

Have you seen my wiki page on binary heap?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline