I feel I'm being moronic, and will come back to this in an hour or so once I've finished some work and do the maths again... but I've checked with four cards (two credit cards, two debit cards, all VISA) and none of them result in a number divisible by ten. Results were 107, 98, 107, 106.<p>Having read <a href="http://en.wikipedia.org/wiki/Luhn_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/Luhn_algorithm</a> I'm either doing it right, or I'm way more tired than I thought. Each card number is 16 digits long, so for (from the left) digits 1, 3, etc. I double them, then I add the sum of those doubles to digits 2, 4, etc.<p>i.e.<p><pre><code> 1234 1234 1234 1234
</code></pre>
Would be:<p><pre><code> ((1 * 2) + 2 + (3 * 2) + 4) * 4
</code></pre>
I feel really dumb for writing that out given it's already written out in this article, and on Wikipedia, but either I <i>am</i> being really dumb or my four cards are all invalid.<p>EDIT: Here is an old card number (card is long expired), and to be safe I've swapped various numbers around (but only swapped even position numbers with each other, and odd position numbers with each other, so it shouldn't effect the check sum). Could someone kindly tell me if I'm being an idiot?<p><pre><code> 5658 4612 3826 9730</code></pre>