Post Reply 
(12C) Luhn algorithm
04-18-2018, 06:29 PM (This post was last modified: 04-18-2018 07:19 PM by pinkman.)
Post: #1
(12C) Luhn algorithm
Ho,
referring to the wikipedia page of the Luhn algorithm, I propose an implementation for the 12c.

How to use it ?

As the 12c has only 10 significant digits, we'll have to split the credit card number into 2 parts.
(Ex: 1234 5678 9012 3456 will be split in 12345678 and 90123456)
After having entered the code, clear the registries 0 and 1 and then enter the right part of the number.
(Ex: 90123456)
Then hit R/S until it displays 0 (don't forget to hit R/S if there were leading zeros).
You can then enter the left part of the number.
(Ex: 12345678)
Then hit R/S until it displays 0 (don't forget to hit R/S if there were leading zeros).

The Luhn key is in REG 0 => RCL 0 Smile

If it is a multiple of 10, your Luhn key is OK.
The number of processed digits is in REG 1.

To test :
543210 => 15 in REG 0 (Luhn KO)
543215 => 20 in REG 0 (Luhn OK)

Looking forward to reading you.
Thibault

Code:

001- 1
002- 0
003- ÷
004- ENTER
005- INTG
006- X<>Y
007- FRAC
008- 1
009- 0
010- ×
011- RCL 1
012- 2
013- ÷
014- FRAC
015- x=0 (x=0?)
016- GTO 33 ; GTO odd
017- R↓
018- 2
019- ×
020- 1
021- 0
022- ÷
023- ENTER
024- INTG
025- X<>Y
026- FRAC
027- 1
028- 0
029- ×
030- +
031- STO + 0
032- GTO 35 ; GTO end
033- R↓ ; LBL odd
034- STO + 0
035- 1 ; LBL end
036- STO + 1
037- R↓
038- R↓
039- GTO 00
Find all posts by this user
Quote this message in a reply
Post Reply 


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)