# Example of the use of method 7-3-1

**Explanation of the method**

- Weights (2) 7,3,1,7,… are added to the digits of the original number (1) from right to left;
- The digits are multiplied with the weights, and the results are added up (3);
- The nearest figure to the result ending in zero is determined (4), and the result is deducted from this figure 10 (5);
- The difference (6) serves as the check digit, and the check digit for the original number (1). Calculation of the check digit for number 12131295

Original number (account or reference number) (1) | 1 | 2 | 1 | 3 | 1 | 2 | 9 | 5 | |

Weights (2) | 3 | 7 | 1 | 3 | 7 | 1 | 3 | 7 | |

Multipliers are added up (3) | 3 | 14 | 1 | 9 | 7 | 2 | 27 | 35 | 98 |

Nearest figure ending in zero is determined (4) | 100 | ||||||||

Deduction of the sum of weights (5) | 100-98 | ||||||||

The remainder is the check digit (6) | 2 |

Original number | (1) supplied with a check digit (6): |

Original number | Check digit (location under the account and reference number standard) |

12131295 | 2 |

**CHECK DIGIT AND REFERENCE NUMBER CALCULATOR**

The check digit calculated based on method 7-3-1 is calculated in the account number, reference number and QR code standard.

The calculator allows for the calculation of the check digit, where:

- the information to be entered only includes digits
- the information to be entered consists of 1..19 characters

The following result is provided:

- check digit (single-digit)
- original number, supplied with a check digit

## GENERATION OF MORE THAN ONE REFERENCE NUMBER

**Option 1. **This calculator allows for the generation of up to 100 reference numbers. Select the numeric amount of reference numbers from the pop-up menu. Enter the original number of the first reference number in the first column.

If a company has 100 customers and you wish to generate a reference number for every customer, select “100” in the pop-up menu. Where the customer number of the first customer is 1, the customer number of the second customer is 2, the customer number of the third customer is 3, etc., enter “1” in the column. The original number of the following customers will be calculated by the calculator.

**Option 2.** This calculator allows for the generation of up to 100 reference numbers. If you have a table with the numbers serving as the basis for the customer numbers or other reference numbers, copy these numbers, one below the other, into the column below, and click “Calculate reference numbers”.

**Reference number calculation script for use in information systems (php)**

function arvutaViitenumber($nr){ $nr = (string)$nr; $kaal = array(7,3,1); $sl = $st = strlen($nr); $total = 0; while($sl > 0 and substr($nr, --$sl, 1) >='0'){ $total += substr($nr, ($st-1)-$sl, 1)*$kaal[($sl%3)]; } $kontrollnr = ((ceil(($total/10))*10)-$total); return $nr.$kontrollnr; } |