A Conversation for h2g2 Maths Lab

Base

Post 1

Jhawkesby

Please can someone look at F19585?thread=6057070 to answer my maths question. smiley - smiley


Base

Post 2

toybox

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

Post 3

Jhawkesby

OK I sort of get that but do you mind giving an example in base 2 and let's say base 12 please.


Base

Post 4

Icy North

(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

smiley - cheers Icy


Base

Post 5

Jhawkesby

Thankyou Icy. smiley - cheers


Base

Post 6

toybox

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

Post 7

Jhawkesby

To make sure I am not reading it wrong when you say 1.--- does the . mean a decimal dot.


Base

Post 8

toybox

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) smiley - blush

There are no fractional parts, everything is just integers.


Base

Post 9

Jhawkesby

Great. Thankyou. smiley - cheers
Is there a method of working backwards for it.


Base

Post 10

8584330

>>>> 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?


smiley - smileyHN


Base

Post 11

toybox

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

Post 12

toybox

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

Post 13

Jhawkesby

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. smiley - cheers
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.


Base

Post 14

Jhawkesby

I have noticed the problem.

22= 2*6+4 --> 22= 3*6+4

Sorry about that. smiley - smiley


Key: Complain about this post