9/11/17

Positional system

A natural number is a list of digits. Each digits is a coefficient in section [0,P), where P is called base of positional system.
Assume, that P is common to all positions of number. Then the number with digits can be expressed as:

N = a_n * P^n + a_{n-1} * P^(n-1) + ... + a_2 * P^2 + a_1 * P + a_0.

A digit a_n is called most significant digit, and a_0 least significant digit

Sometimes there is other expression, which is a bit better to calculate, called Hörner schema. The powers are hidden due the brackets in this view:

N = (((...(a_n * P + a_{n-1})*P+...)+ a_2)*P+a_1)*P+a_0.

In this blog this schema is preferred.
To avoid indexes, in blog digits are written a=a_0, b=a_1 etc.  We often use recursion, and expression
N = b*P+a
means also
N'*P+a
where N' is a number (N-a_0)/P .

Examples:
P=10. This is the most using positional system.
P=2. This is binary system, which is used inside processors.