From: Ari Brown Date: 2007-04-29T12:04:01+09:00 Subject: Re: [QUIZ] Checking Credit Cards (#122) 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? Help me, hyperactive ruby posters! ~ Ari English is like a pseudo-random number generator - there are a bajillion rules to it, but nobody cares.