From: Mark Day Date: 2007-04-29T14:14:04+09:00 Subject: Re: [QUIZ] Checking Credit Cards (#122) --Apple-Mail-1--199527535 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Apr 28, 2007, at 8:04 PM, Ari Brown wrote: >> 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? This confused me at first, too. Let's take just the last four digits: 7893. Counting from the end, double every second digit, leaving the others unchanged. That gives you: 14, 8, 18, 3 (where 14=7*2 and 18=9*2; the 8 and the 3 are unchanged). Now add up every digit of the resulting sequence: 1+4 + 8 + 1+8 + 3. Note the "1 +4" comes from the 14, and the "1+8" comes from the 18. Does that help? -Mark --Apple-Mail-1--199527535--