Talk:Luhn algorithm: Difference between revisions

Content deleted Content added
SineBot (talk | contribs)
m Signing comment by 125.236.50.155 - ""
Line 50:
 
:Agreed, but the code for this would be so similar to the CreateNumber example as to get repetitive (based on idea that this is not code repository). Would it be more relevant to replace CreateNumber with GetCheckDigit? Probably best to just go with one or the other. Would be happy to post calc function if deemed more relevant than existing CreatNumber. [[User:Skratowicz|Skratowicz]] 03:31, 29 June 2007 (UTC)
 
:The algorithm to create the check digit the same algorithm, with an extra step at the end. Put 0 in as a temporary placeholder for the check digit, then calculate the sum (as explained in the article). Calculate the '''sum modulus 10'''. If the result is 0, then you're done - the check digit is zero. Otherwise, the check digit is '''10 - (sum modulus 10)'''. Using the example from the article, we start with the base account number of 499273987''x'', where ''x'' is the check digit. Substitute zero for ''x'', and the calculations are: 0 + (2) + 7 + (1+6) + 9 + (6) + 7 + (4) + 9 + (1+8) + 4 = 64 ''(compare to step 2 in the main article's illustration)''. 64 modulus 10 is 4, so the check digit is 10-4, or 6. [[Special:Contributions/205.210.222.150|205.210.222.150]] ([[User talk:205.210.222.150|talk]]) 14:15, 16 April 2009 (UTC) Jim Hyslop
 
=== Comments on Changes ===