From: James Edward Gray II Date: 2007-04-29T13:22:57+09:00 Subject: Re: Checking Credit Cards (#122) On Apr 28, 2007, at 10:50 PM, Phrogz wrote: > On Apr 28, 9:04 pm, Ari Brown wrote: >> On Apr 27, 2007, at 7:59 AM, Ruby Quiz wrote: >>> 1. Starting with the next to last digit and continuing with every >>> other >>> digit going back to the beginning of the card, double the >>> digit >>> 2. Sum all doubled and untouched digits in the number >>> 3. If that total is a multiple of 10, the number is valid >> >>> For example, given the card number 4408 0412 3456 7893: >> >>> Step 1: 8 4 0 8 0 4 2 2 6 4 10 6 14 8 18 3 >>> Step 2: 8+4+0+8+0+4+2+2+6+4+1+0+6+1+4+8+1+8+3 = 70 >>> Step 3: 70 % 10 == 0 >> >>> Thus that card is valid. >> >> Uh, this is probably just affecting me but.... >> >> In his example, after he doubles the second to last digit (call it >> d), he uses mod10 on it (9*2 = 18 %10 = 8). That is the way to get >> his numbers, but a) where does he say that and b) where do the 10 and >> 14 come from? > > The confusing part (that I didn't catch when I read it) is that step 2 > is to sum all the *digits*, not the numbers. > > So > step 1) 9 * 2 = 18 > step 2) 1 + 8 > > He's not modding the result of the multiplication by 10, but rather > adding up the resulting component digits. The same occurs with the 10 > and 14 (which Philip pointed out are the result of 5*2 and 7*2, > respectively). Yes, most descriptions tell you to mod 10 the bigger numbers to get the back to a single digit, but that adds a step that doesn't have any affect. I left it out. James Edward Gray II