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.

Base N Convert - dCode

Tag(s) : Mathematics,Arithmetics

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*!

This page is using the new English version of dCode, *please make comments* !

Sponsored ads

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.

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 c_{i} 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.

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 r_{i} (starting from units with r_{1}).

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)} $$

One uses the folowing 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 base 7 se converti en base 10 ainsi :

$$ N = 1; $$

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

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

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

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

- base 26 (alphabetic system)

- base 36 (alphanumeric system)

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

- base 62 (full alphanumeric system)

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 !

base,convert,change,modulo,decimal,octal,binary,hexadecimal,system,digit,number,letter

Source : http://www.dcode.fr/base-n-convert

© 2016 dCode — The ultimate 'toolkit' website to solve every problem. dCode