Math Is Fun Forum

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

You are not logged in.

#1 2010-08-07 15:17:41

Philip II
Member
Registered: 2010-08-07
Posts: 3

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!:D

Offline

#2 2010-08-07 16:02:30

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2010-08-07 16:15:51

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

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

Offline

#4 2010-08-08 06:33:56

Philip II
Member
Registered: 2010-08-07
Posts: 3

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

Offline

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

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#6 2010-08-08 12:13:13

Philip II
Member
Registered: 2010-08-07
Posts: 3

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?

Offline

#7 2010-08-08 16:28:36

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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

Really that's your advice? "Learn computers"

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?

Perhaps you are going to have to learn a little bit about computers, the internet, downloading, compilers etc.


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

#8 2010-08-08 18:06:28

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

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

Offline

#9 2010-11-29 12: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-29 13:18:04

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#11 2011-04-27 12:13:45

soroban
Member
Registered: 2007-03-09
Posts: 452

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



. .


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


. .

. .

. .

. .

. .

. .

. .

. .

. .

. .


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


. .

. .

.

Offline

Board footer

Powered by FluxBB