Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The above code should work for any number of digits. It follows the spec given in the article, specifically:

    1. Write out all but the last digit of the card number.

    2. Write out all but the last digit of the card number.

    3. Starting from the right, double every other number.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: