views:

142

answers:

6

I know 75(base8) = 61(base10), but I can't easily find the formula for this. How does one convert from base 8 to base 10?

+6  A: 

0 * 85 + 0 * 84 + 0 * 83 + 0 * 82 + 7 * 81 + 5 * 80 = 61

Daniel Daranas
@MSalters: Nice edit, thank you.
Daniel Daranas
+2  A: 

The formula is 18 = 110 and 108 = 810. Everything else can be derived from that.

If you have a sequence of base 8 digits you want to convert to a base 10 number, process them from left to right, keeping a total you initialize at zero. For each digit x, set the total to 8*total+x. After processing the last digit, the total will be the base ten value of the base 8 sequence.

rampion
+1  A: 

75 in base 8 = 5*8^0 + 7*8^1 = 5 + 56 = 61

In general, to convert the number a_1a_2a_3...a_n from base k to base 10, use the formula:

a_n*k^0 + a_(n-1)*k^1 + ... + a_1*k^(n-1).

IVlad
A: 

137461(base8) = 1 x 8^0 + 6 x 8^1 + 4 x 8^2 + 7 x 8^3 + 3 x 8^4 + 1 x 8^5

Arthur Kalliokoski
+1  A: 

To convert any base to base 10 just do the following:

For every digit in the different base multiply that by the base and digit. For example:

75 (base 8) = 7*8^1 + 5*8^0 = 61 

Works for any base ... binary, hex, you name it just do that and it will convert to base 10.

Travis
wow ... we all just posted these answers within seconds of eachother...
Travis
so `5*8^0` is the same as `5*1`?
HollerTrain
yes it is ... anything raised tot he zero power is equal to 1 ... aka 8^0 = 1
Travis
@Travis: That's not a method for converting it to base 10, that's just a method for interpreting it as an integer. The base 10 conversion is done by your calculator (or else you just you did it subconsciously in your head).
Mark Byers
@Mark: What's the difference? Once you get the integer 61, expressing it in base 10 is as easy as writing "61".
Daniel Daranas
A: 

given this is a programming site:

int oct_to_dec = 075;
printf("%d",oct_to_dec);
jk