Checksum
The checksum (or digit sum ) is usually the sum of the digit values of a natural number . For a number n = 36036 the decimal checksum q ( n ) = 3 + 6 + 0 + 3 + 6 = 18. The checksum (like the cross product ) depends on the number system used .
In addition to the checksum as the sum of the numerical values, there is
- the alternating checksum (alternating addition and subtraction of the digit values),
- Operations with digit pairs, triples, etc.,
- locally weighted procedures.
Definitions
Definition by the sum of the digit values
If the natural number becomes the base with as
represented ( -adic representation with the numerical values and ), then is the sum of their numerical values
the checksum of . Alternatively, the checksum can also be saved as
can be specified. It is
the number of digits from .
Note: Here are the mathematical modulo function and the Gaussian bracket .
Recursive definition
The recursive definition of the cross sum of the natural number to the base with is:
Graph course
The graph of the checksum function has a characteristic curve. In the decimal system , it rises steadily for ten consecutive numbers ending with 0 to 9 - by 1 per step - and then falls for one number. However, the lowest and highest values of the increase range shift from time to time by 1 upwards.
This behavior is repeated in every power of ten. At 10, 100, 1000 etc. it always falls to 1. This results in a self-similarity of the graph.
Only applies to , is for all larger numbers . There is no upper limit.
application
Every time numbers are entered and transmitted, technical or human errors can occur. This is why test procedures exist to ensure data integrity. A simple checksum measure is the formation of the checksum .
Check digit of the ISBN
The cross sum of an ISBN -10 (outdated version) weighted with the factors (10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ) is always 0 modulo 11 (the number “X” has the numerical value of 10 and can appear in the last digit). This is achieved by the first 9 digits describing the product and adding a tenth digit (check digit) so that the above requirement is met.
Example: For the ISBN 3-442-54210-3 is
So this is a (formally) valid ISBN.
Checksum set
- Given the following:
- a place value system with the base (where ),
- a divisor of (where ),
- a natural number .
- Then:
- The number is divisible by exactly if its checksum (in this place value system) is divisible by .
For example, in the decimal system, the base is 10, so . So is . Hence, the checksum rule can be used to check divisibility by 3 and by 9.
In the hexadecimal system is . So is . So you can use the checksum rule in the hexadecimal system to check divisibility by 3, by 5 and by 15.
In general, the cross sum of the representation of a number in the place value system with the base leaves the remainder modulo unchanged, i.e.
- ,
and the alternating checksum of the representation of a number in the place value system with the base leaves the remainder modulo unchanged, i.e.
- .
Special case: trial of nine
For the divisibility of a number by 3 or 9 , its checksum can be used as a representative: A number represented in decimal is divisible by 3 or 9 if its checksum is divisible by 3 or 9 without a remainder. In general, when dividing by 3 or 9, the remainder is the same as the checksum :
- or.
(Or to put it another way: the difference between a number and its checksum is always divisible by 9.)
More types
Single digit (or iterated) checksum
The cross-sum is formed from the simple cross-sum until only a single-digit number remains.
Example:
If the cross sum of a number k is a multi-digit number, the process can be repeated until the result only has one place in the respective number system . For the iterated checksums generated in this way (always one-digit), the following applies ( t , as above, is again the basis of the number system - 1):
Example in the decimal system:
- ,
and it is
- .
In particular, a positive natural number is divisible by 9 if and only if its iterated checksum in the decimal system is 9.
See also: hash function and the procedures mentioned there.
Alternating checksum
The alternating cross sum (also known as cross difference, pair cross sum or alternating sum) is obtained by alternately subtracting and adding the digits of a number. You can start on the left or right. The following starts from the right. So for the number n = 36036 the alternating checksum aqs ( n ) = 6 - 3 + 0 - 6 + 3 = 0.
The following procedure is equivalent to this (counting the digits should start again on the right):
- Add to the value of the first digit that of the third, fifth, seventh, etc.
- Add the fourth, sixth, eighth, etc. to the second digit.
- If you now subtract the second from the first sum, you get the alternating cross sum.
For the divisibility of a number n by 11 , its alternating checksum aqs ( n ) can be used as a representative: A decimal number n is divisible by 11 if and only if its alternating checksum aqs ( n ) is divisible by 11 without a remainder.
Repeated use of the alternating checksum yields the remainder of the number when dividing by 11, with negative values being normalized by adding 11. An aqs of 11 results in another formation of an aqs, which returns 0 (i.e. the remainder of the division of 11 by 11).
Example:
n = 2536874 4 + 8 + 3 + 2 = 17 7 + 6 + 5 = 18
17 - 18 = -1; -1 + 11 = 10
From this follows: The number 2536874 leaves the remainder 10 when divided by 11, so it is not divisible by 11.
Non-alternating k- sum
The non-alternating 2- digit sum of n = 36036 is q = 3 + 60 + 36 = 99. For all divisors of 99, i.e. for 3, 9, 11, 33 and 99, it is a divisibility criterion: The non-alternating 2-digit sum q one decimal number n is divisible by these numbers if and only if n is divisible by them.
The non-alternating 3- digit sum of n = 36036 is q = 36 + 036 = 72. For all factors of 999, i.e. for 3, 9, 27, 37, 111, 333 and 999, it is a divisibility criterion: The non-alternating 3-digit sum q of a decimal number n is divisible by these numbers if and only if n is divisible by them.
Note : The non-alternating k- sum is identical to the non-alternating sum of the base . It provides a divisibility criterion for all factors of .
Alternating k sum of digits
The alternating double checksum of n = 36036 is q = 3 - 60 + 36 = −21. For 101 it is a divisibility criterion: The alternating 2's checksum q of a decimal number n is divisible by 101 if and only if n is divisible by 101.
The alternating 3- digit checksum of n = 36036 is q = −36 + 036 = 0. For all divisors of 1001, i.e. for 7, 11, 13, 77, 91, 143 and 1001, it is a divisibility criterion: The alternating 3-digit Check sum q of a decimal number n is divisible by these numbers if and only if n is divisible by the numbers.
Note : The alternating k- sum is identical to the alternating sum to the base . It provides a divisibility criterion for all factors of .
Weighted checksum
Weighted checksums are a generalization , in which the digits are first multiplied by the values of a number sequence and these results are then added. It begins with the least significant digit (the order does not matter with the simple checksum). The weighting sequence can be periodic or non-periodic. An example is the periodic sequence 1, 3, 2, −1, −3, −2, ... The weighted cross sum of the number 422625 is (starting with the lowest digit):
- 5 1 + 2 3 + 6 2 - 2 1 - 2 3 - 4 2 = 5 + 6 + 12 - 2 - 6 - 8 = 7
The cross sum weighted in this way provides a divisibility rule for the number 7. Such periodic sequences can also be found for other natural numbers, e.g. B.
- for 11 the sequence +1, −1, ... This supplies the so-called alternating checksum
- for 13 the sequence 1, −3, −4, −1, 3, 4, ...
For most dividers, however, it is not practical to check the divisibility by means of checksums, because there are only a few easily noticeable periodic weighting sequences.
If one wants to find a corresponding rule of divisibility for the natural number m , one considers the remainder of the powers of 10 when dividing by m . The remnants correspond to the weights sought.
Example: m = 7
- 1 ≡ 1 (mod 7)
- 10 ≡ 3 (mod 7)
- 100 ≡ 2 (mod 7)
- 1000 ≡ −1 (mod 7)
- 10000 ≡ −3 (mod 7)
- 100000 ≡ −2 (mod 7)
- 1000000 ≡ 1 (mod 7) (from here the remainders are repeated)
The weighting sequence is 1, 3, 2, −1, −3, −2, ...
See also
Web links
Individual evidence
- ↑ Hans Schubart: Introduction to Classical and Modern Number Theory. Vieweg, Braunschweig 1974, ISBN 3-528-03313-4 , p. 47.
- ↑ checksum. In: Herrmann Engesser (edit.): The small dictionary of mathematics. Bibliographisches Institut, Mannheim / Vienna / Zurich 1986, ISBN 3-411-02180-2 , p. 364.