Search for a tool
Base N Convert

Tool to write numbers in base N. In numeral systems, a base (radix) is the value of successive powers when writing a number. Until base 10, it is common to use digits 0, 1, 2, 3, 4, 5, 6, 7, 8 et 9, after, some others symbols such as letters.

Results

Base N Convert -

Tag(s) : Mathematics,Arithmetics

dCode and you

dCode is free and its tools are a valuable help in games, puzzles and problems to solve every day!
You have a problem, an idea for a project, a specific need and dCode can not (yet) help you? You need custom development? Contact-me!

Team dCode read all messages and answer them if you leave an email (not published). It is thanks to you that dCode has the best Base N Convert tool. Thank you.

# Base N Convert

Also on dCode: Binary CodeBase 26 Cipher

## Converting Base 10 to Base N

Also on dCode: Binary CodeBase 26 Cipher

Tool to write numbers in base N. In numeral systems, a base (radix) is the value of successive powers when writing a number. Until base 10, it is common to use digits 0, 1, 2, 3, 4, 5, 6, 7, 8 et 9, after, some others symbols such as letters.

### What are default symbols?

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ (Beware to lowercase and uppercase from base 37)

### How to convert from one base to another?

A number N un a base n can be written with an addition of powers in this base n.

123 = 1*100 + 2*10 + 3*1 = 1*10^2 + 2*10^1 + 3*10^0

If a number is composed of digits ci in base b, one gets a polynomial with digits as coefficients and the base b as variable:

$$c_n...c_2c_1c_0 = c_n b^n + ... + c_2 b^2 + c_1 b^1 + c_0 b^0$$

To make a base conversion, generally one can use the base 10 as reference, or as an intermediate base.

To calculate from base 3 to base 7, on can calculate from base 3 to base 10 and from base 10 to base 7.

### How to convert from base 10 to base n?

One uses the following algorithm to convert from base 10 to base n:

$$q_0=n; i=0; \mbox{ while } q_i >0 \mbox{ do } (r_{i+1}= q_i \mbox{ mod } b; q_{i+1}= q_i \mbox{ div } b ; i = i+1 )$$

The converted number is composed of digits ri (starting from units with r1).

123 base 10 is converted in base 7 like this:

$$r_1 = 123 \mbox{ mod } 7 = 4 ; q_1 = 123 \mbox{ div } 7 = 17$$

$$r_2 = 17 \mbox{ mod } 7 = 3 ; q_2 = 17 \mbox{ div } 7 = 2$$

$$r_3 = 2 \mbox{ mod } 7 = 2 ; q_3 = 2 \mbox{ div } 7 = 0$$

$$123_{(10)} = 234_{(7)}$$

### How to convert from base n to base 10?

One uses the following algorithm to convert from base n to base 10:

$$N =c_n ; i=n \mbox{ for } i=n-1 \mbox{ to } 0 \mbox{ do } N=N*b+c_i$$

The number N is now written in base n.

123 in base 7 in conveted in base 10 like this:

$$N = 1;$$

$$N = 1*7+2 = 9$$

$$N = 9*7+3 = 66$$

$$123_{(7)} = 66_{(10)}$$

### What are usual bases?

- base 2 (binary system) in informatics

- base 3 (trinary system)

- base 8 (octal system)

- base 9 (nonary system)

- base 10 (decimal system)

- base 12 (duodecimal system), for month or hours

- base 16 (hexadecimal system) in informatics for bytes

- base 20 (vigesimal system) by Mayas and Aztecs

- base 26 (alphabetic system)

- base 36 (alphanumeric system)

- base 60 (sexagesimal system) for minutes, seconds by Sumerians and Babylonians.

- base 62 (full alphanumeric system)

## Source code

dCode retains ownership of the source code of the script Base N Convert. Except explicit open source licence (free / freeware), any algorithm, applet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any snippet or function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in PHP (or Java, C#, Python, Javascript, etc.) which dCode owns rights can be transferred after sales quote. So if you need to download the Base N Convert script for offline use, for you, your company or association, see you on contact page !

Team dCode read all messages and answer them if you leave an email (not published). It is thanks to you that dCode has the best Base N Convert tool. Thank you.

Source : http://www.dcode.fr/base-n-convert
© 2016 dCode — The ultimate 'toolkit' website to solve every problem. dCode