× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Bob,

Is LUHN specific to credit card numbers?  If so, it may depend on the number
of digits that are known to be used by credit card issuers.   

Eric DeLong
Sally Beauty Company
MIS-Project Manager (BSG)
940-898-7863 or ext. 1863



-----Original Message-----
From: Bob Cozzi [mailto:cozzi@xxxxxxxxx]
Sent: Wednesday, February 25, 2004 8:43 AM
To: 'RPG programming on the AS400 / iSeries'; RPGIV@xxxxxxxxxxxxxxx
Subject: RE: Modulus 10 formula (REPOST)


Gosh, is it too early for me to type or what??? :)
-Bob

I've been going back and forth on a Modulus10 routine because, as it turns
out there seems to be two different formulas: IBM and LUHN.
The biggest issue is a subtle one which follows.
With IBM, you always start with the left most digit (highest order digit)
and select the even position digits by moving to the right and multiplying
hem by two.
This seems to be done regardless of the length of the original number;
therefore,  34567 would use 3, 5 and 7, and 4567 would use 4 and 6.
But the LUHN Modulus 10 formula begins with the rightmost digit (lowest
order digit) and selects every other digit moving to the left, and multiples
them by two.
 
So with IBM we would get this (starting on the left):

Start with:  3456
Step 1:  Multiple 3 and 5 by 2 =  6 10 
Step 2: Add them:  6 + 4 + 1 + 0 + 6  = 17
Step 3:  20 - 17 = 3
Check Digit = 3
Result:   3456-3

But with the LUHN formula we would get this:

Start with 3456
Step 1: Multiple 4 and 6 by 2 = 12 and 8
Step 2: Add them:  3 + 8 + 5 + 1 + 2 = 19
Step 3:  20 - 19 = 1
Check Digit = 1
Result:  3456-1


So is the IBM one screwy or are there two of them?

-Bob Cozzi

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.