Unless this is an academic exercise, another thing to bear in mind is that these days a lot of issuers and processors don't even do mod-10 checks anymore. If your volumes are high, these additional checks just add to your transaction processing time and make timeouts incrementally more likely; CPU cycles aren't free.
If you're an issuer, you know which cards are yours because you already have the full PAN in your card table. Invalid ones (those that look legit but have bad check digits) just won't be there. And if you're a processor, you probably just care about the BIN, for routing transactions to the issuer, and not the rest of the PAN.
Calculating check digits is still used however in provisioning cards, when you create the PAN in the first place.