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

You are not logged in.

## #1 2010-08-08 13:17:41

Philip II
Novice

Offline

### Base 3 -> Base 10 Code. Computer Newb

I have zero experience with computers outside the webnets and HTML. How would I make a code that converts a base 3 number (such as 2011) to a base 10 number (58)? Would it have a limit to its compacity (outside of my computers processing power)?

Thanks!

## #2 2010-08-08 14:02:30

bobbym

Online

### Re: Base 3 -> Base 10 Code. Computer Newb

Hi Philip II;

I don't recommend being shown this conversion. I think it is a very important step in a beginners computer education.

The method to convert follows directly from the representation of the number in base 3. Starting from the right and working left.

Do you see a method now?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #3 2010-08-08 14:15:51

MathsIsFun

Offline

### Re: Base 3 -> Base 10 Code. Computer Newb

This may also help: Base Conversion Method

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

## #4 2010-08-09 04:33:56

Philip II
Novice

Offline

### Re: Base 3 -> Base 10 Code. Computer Newb

I understand the process. What I need is a code that does it for me. I don't have time to convert 300-400 digit long base 3 numbers. I know it sounds ridiculous that I need numbers that large in base 3, but I do

## #5 2010-08-09 07:41:37

bobbym

Online

### Re: Base 3 -> Base 10 Code. Computer Newb

Hi Philip II;

You need to learn a programming language to start. Then you can do it yourself or just google for a base conversion program.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #6 2010-08-09 10:13:13

Philip II
Novice

Offline

### Re: Base 3 -> Base 10 Code. Computer Newb

Really that's your advice? "Learn computers"? Couldn't one of you excellent coders just provide me with the code?

## #7 2010-08-09 14:28:36

bobbym

Online

### Re: Base 3 -> Base 10 Code. Computer Newb

No, that is not what I said! Not learn computers, learn a programming language. At least have one installed so you can run code!!!!! It wouldn't hurt to learn something.

Couldn't one of you excellent coders just provide me with the code

Code for what? What languages do you speak? What languages do you have access to. Do you have some dialect of BASIC. QBASIC, Liberty Basic, Visual Basic? Do have a Borland C++, Microsoft C, GNU C? Delphi, Lisp, Forth, Python on your machine, what?
You just don't get code, code has to be interpreted or compiled by some language

#### bobbym wrote:

just google for a base conversion program.

That was good advice there are probably 100 such programs for download on the internet right now. They are execs and you just have to run them.

If you can't program and don't have a language on your machine to compile code given to you. Then you must Google for a program that does it for you. Do you know how to google?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #8 2010-08-09 16:06:28

MathsIsFun

Offline

### Re: Base 3 -> Base 10 Code. Computer Newb

As bobbym suggests, first you need a language to code in. You can, for example, use actionscript to make flash animations, or PHP, java, javascript etc to make code for a website, C. C++, VB.net, etc to make desktop applications, just to name a few.

Perhaps you could let us know a bit more about what you need it for?

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

## #9 2010-11-30 11:17:07

Gameguru
Guest

### Re: Base 3 -> Base 10 Code. Computer Newb

//C++ FUNCTION:

//base_convert
//arguments:
//iNumber = number to convert from
//iBase = base to convert to
int ConvertBase (int iNumber, int iBase)
{
int iResult = iNumber % iBase;
int iMultiplier = 10;

while((iNumber /= iBase) > 0)
{
iResult = (iNumber % iBase) * iMultiplier + iResult;
iMultiplier *= 10;
}

return iResult;
}}

This code will not compile by itself.

## #10 2010-11-30 12:18:04

bobbym

Online

### Re: Base 3 -> Base 10 Code. Computer Newb

Hi;

Maybe my vision is not so good but have you counted your left and right brackets?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #11 2011-04-28 10:13:45

soroban
Power Member

Offline

### Re: Base 3 -> Base 10 Code. Computer Newb

. .

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

. .

. .

. .

. .

. .

. .

. .

. .

. .

. .

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

. .

. .

.