(12C) Luhn algorithm
|
04-24-2018, 07:40 PM
(This post was last modified: 04-24-2018 08:20 PM by Dieter.)
Post: #5
|
|||
|
|||
RE: (12C) Luhn algorithm
(04-18-2018 06:29 PM)pinkman Wrote: referring to the wikipedia page of the Luhn algorithm, I propose an implementation for the 12c. Here is a version for a special application of the Luhn algorithm. The latter is often used to add a check digit to a locomotive's class/serial number. The German Federal Railways have been using this method since 50 years now, which maybe is a good reason to introduce this special program version. ;-) Code: 01 STO 0 Usage: Enter the six-digit vehicle number (class and serial number) and the program adds the check digit (right of the decimal point). Example: 103 118 => 103.118,6 111 111 => 111.111,1 You can also use this program to calculate the check digit for other numbers with up to nine digits: 123456789 => 123.456.789,7 If you replace line 38...40 with "10 x" only the check digit is returned and up to 10 digits can be processed. In this case you may also replace the initial STO 0 with FIX 0. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(12C) Luhn algorithm - pinkman - 04-18-2018, 06:29 PM
RE: (12C) Luhn algorithm - Dieter - 04-23-2018, 08:19 AM
RE: (12C) Luhn algorithm - pinkman - 04-24-2018, 08:00 AM
RE: (12C) Luhn algorithm - Dieter - 04-24-2018, 06:35 PM
RE: (12C) Luhn algorithm - Dieter - 04-24-2018 07:40 PM
RE: (12C) Luhn algorithm - pinkman - 04-24-2018, 08:27 PM
RE: (12C) Luhn algorithm - Dieter - 04-25-2018, 07:22 AM
RE: (12C) Luhn algorithm - pinkman - 04-25-2018, 02:52 PM
|
User(s) browsing this thread: 1 Guest(s)