A Conversation for h2g2 Maths Lab
Base
Jhawkesby Started conversation Nov 10, 2008
Please can someone look at F19585?thread=6057070 to answer my maths question.
Base
toybox Posted Nov 10, 2008
Indeed, "42 in base b" is shorthand for 4b+2. In base 10 it gives 4x10+2, as expected. Similarly, "542 in base b" is 5xb^2 + 4xb + 2, and you use higher powers of b for longer "b-ary" expressions.
(Note that b has to be strictly larger than all the "b-ary digits". For example, you don't write 542 in base 4.)
Base
Jhawkesby Posted Nov 10, 2008
OK I sort of get that but do you mind giving an example in base 2 and let's say base 12 please.
Base
Icy North Posted Nov 10, 2008
(I'll leave TB to answer your query, as he's pretty damn good at Maths)
I wrote about bases in this entry, if you're ever bored: A20725760
Icy
Base
toybox Posted Nov 10, 2008
OK then, examples in base 2 and 12. We'll write below expressions like [42] to mean "42 in base something" (and we keep the ordinary 42 for the one we are used to in base 10)
An example in base 2 (note that the only "digits" which are allowed are 0 and 1). We use b=2:
[110] = 1.b^2 + 1.b + 0.1 = 4 + 2 = 6.
An example in base 12. here the allowed "digits" are 0,1,2,...,9,10,11 (all natural integers strictly smaller than 12). We use simple symbols A and B instead of 10 and 11 to avoid confusion.
[1853] = 1.b^3 + 8.b^2 + 5.b + 3 = 1728 + 1152 + 60 + 3 = 2943.
An example where "A" means "10":
[2A5] = 2.b^2 + 10.b + 5 = 288 + 120 + 5 = 413.
Base
Jhawkesby Posted Nov 10, 2008
To make sure I am not reading it wrong when you say 1.--- does the . mean a decimal dot.
Base
toybox Posted Nov 10, 2008
It means multiplication, but I didn't want to use x (as in: 5xb^2) and didn't think of using * (as in: 5*b^2)
There are no fractional parts, everything is just integers.
Base
8584330 Posted Nov 10, 2008
>>>> Is there a method of working backwards for it.
Sorry it is terribly early for me here.
Do you mean, here is a number, 12345, now figure out what base it is in?
Or 12345 is in base 7, what would it be in base 9?
HN
Base
toybox Posted Nov 10, 2008
You mean, having a number like 813 and trying to find its, say, 6-ary decomposition? Yes there is.
Recall the division with remainder: every integer can be written as something times 6 plus a remainder in the set {0,1,...,5}.
For example you have: 819 = 136*6 + 3.
Keep the remainder (here, 3): the decomposition you want looks like [....3].
Now take the "136" bit of the above (it is called the quotient, if you must know) and perform the same operation:
136 = 22*6 + 4.
The decomposition will look like [....43].
Repeat with the new quotient (22):
22 = 2*6 + 4.
You get the decomposition [...443].
The last quotient was 2, which is smaller than 6 so you cannot get anything new with the division with remainder trick. So you keep the "2" and put it in front of the decomposition: [2443].
Hence, 819 is [2443] in base 6.
I let you imagine how it is performed for other bases instead of 6. If you think of it, that's exactly what we do when we write numbers with the decimal system: if we take for example 8365,
- 8365 = 836*10 + 5
- 836 = 83*10 + 6
- 83 = 8*10 + 3
- * = 0*10 + 8.
The digits 8,3,6,5 appear as the remainders when you read them upwards.
Base
toybox Posted Nov 10, 2008
HN - that would be the second question, because 12345 can be the decomposition of a number in base 6,7,8,42, etc. (any number strictly larger than 5 actually).
Base
Jhawkesby Posted Nov 10, 2008
Don't worry HN what I mean is that here is a number in base 10 and I want to know if there is a method to see what the number would be in base whatever which is what Toybox answered.
Thankyou Toybox for that.
There is only one thing when I checked to see if the method worked I did 2*6^3 + 4*6^2 + 4*6 + 3 it equals 603. Is that suppose to happen.
Key: Complain about this post
Base
- 1: Jhawkesby (Nov 10, 2008)
- 2: toybox (Nov 10, 2008)
- 3: Jhawkesby (Nov 10, 2008)
- 4: Icy North (Nov 10, 2008)
- 5: Jhawkesby (Nov 10, 2008)
- 6: toybox (Nov 10, 2008)
- 7: Jhawkesby (Nov 10, 2008)
- 8: toybox (Nov 10, 2008)
- 9: Jhawkesby (Nov 10, 2008)
- 10: 8584330 (Nov 10, 2008)
- 11: toybox (Nov 10, 2008)
- 12: toybox (Nov 10, 2008)
- 13: Jhawkesby (Nov 10, 2008)
- 14: Jhawkesby (Nov 10, 2008)
More Conversations for h2g2 Maths Lab
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."