Aug 032007

Disclaimer :- In support of better world, i condemn all kinds of piracies and severely disparage the people who do credit card forging and fraud. This knowledge is already in public domain. I was too ignorant to discover it quite late.

Do you know that the numbers on your credit card hold a pattern? If they deviate from a pattern, then they are invalid. I did not know this till morning. What is it? I’m putting it in form of this mathematical expression. You need to tell me what it means.

$latex \bigg[ \sum_{i=1}^{16} \big[ [((i + 1) \bmod{2}) x_i ] + [(i \bmod{2}) (2x_i \bmod{9} )] \big] \bigg] \bmod {10} = ?$

where $latex x_{i}$ is $latex i ^{th}$ digit of your credit card number. (e.g) $latex x_{1}$ is first digit of your credit card, and $latex x_{16}$ is last digit of your credit card. You will find it interesting. Post your solutions!

Updates :- I forgot to mention that kaddy was the person who initiated this. He is a wonderful photographer. Vote for his photographs at aminus3.

ashish

  • There is something wrong with the way my comment is getting displayed!!! :(
  • In layman's terms it is equivalent to:

    [ Sum(Even digits) + Sum( 2*Odd Digits Mod 9) ] Mod 10 = 0 and algo for calculating it would be:

    //ccnos[1..16] contains the credit card digits.
    int sum = 0;
    for (int i=1; i0 && sum%10==0) return goForFurtherVerification;

    The sum >0 criteria was added by me for invalidating 0000 0000 0000 0000.
  • In layman's terms it is equivalent to:

    [ Sum(Even digits) + Sum( 2*Odd Digits Mod 9) ] Mod 10 = 0 and algo for calculating it would be:

    //ccnos[1..16] contains the credit card digits.
    int sum = 0;
    for (int i=1; i0 && sum%10==0) return goForFurtherVerification;

    The sum>0 criteria was added by me for invalidating 0000 0000 0000 0000.
  • i learned it tough way by reverse engineering a javascript on IRCTC today when i accidently punched in wrong card number :))
  • a
    its more like
    x_16(check digit) = (10-(sum_{x=1}^{15}f)mod10) mod 10.

    Expression you gave is only for validation. Somehow this is simple single error checking algorithm. if you see, it cares order only upto 2 digits, so transposition of pairs won't affect.
  • Sum of digits at even positions = multiple of 10.

    Sum of digits at odd positions = multiple of 10 + 9.

    The answer of the equation is zero.

    (with little help from my card.)
blog comments powered by Disqus

Switch to our mobile site