{
  "address": "72d5094611a21ce9323ceb82031de937",
  "category": "other",
  "question": "Does the number 4111111111111111 pass the Luhn check?",
  "answer": "true",
  "askedBy": {
    "kind": "guest",
    "display": "method deck",
    "stamped": false,
    "id": null
  },
  "answeredBy": "method",
  "madeAt": "2026-09-30T22:39:30.722Z",
  "validUntil": null,
  "validityClass": "forever",
  "sources": [
    {
      "label": "ISO/IEC 7812-1 (Luhn checksum for card numbers)",
      "url": null
    }
  ],
  "supersedes": null,
  "supersededBy": null,
  "isSeed": false,
  "seedSource": null,
  "seedAttribution": null,
  "duplicateOfQid": null,
  "publishedAt": null,
  "unpublishedAt": null,
  "voteCount": 0,
  "queuedForSubstrate": false,
  "answerMethod": "method",
  "unsourced": false,
  "source": {
    "kind": "standard",
    "value": "ISO/IEC 7812-1:2017, Identification cards - Identification of issuers - Part 1: Numbering system.",
    "retrieved_utc": "2026-09-30T20:01:00Z"
  },
  "qsha256": "cf8d90996176926b8fb9f23575f92352507aa62b5b579923b7ef265ab7f435e1",
  "runOne": null,
  "cardContractVersion": "card_contract/1",
  "deck_id": "method-deck",
  "deck_title": "Method Deck",
  "method": {
    "name": "Luhn check digit",
    "version": "1",
    "source_url_or_file": "methods/luhn-check-digit.cjs",
    "sha256_of_method_file": "61e73388a5c12629a719b9db879b3aac72211a8a05a568e333705b6806dcaa5e"
  },
  "receipt": {
    "inSubstrate": false,
    "local": true,
    "modelCallsAtMint": 0,
    "tokensAtMint": 0
  },
  "method_deck": {
    "inputs": [
      {
        "name": "mode",
        "type": "string",
        "required": true,
        "description": "Whether to validate a full number or compute a check digit for a number missing one.",
        "enum": [
          "validate",
          "compute_check_digit"
        ]
      },
      {
        "name": "number",
        "type": "string",
        "required": true,
        "description": "Digits only. For validate: the full number including its check digit. For compute_check_digit: the number without its check digit."
      }
    ],
    "outputs": [
      {
        "name": "result",
        "description": "For validate: true or false. For compute_check_digit: the single check digit (0-9)."
      }
    ],
    "steps": [
      "The Luhn algorithm (used for card numbers per ISO/IEC 7812-1): starting from the rightmost digit of the full number (the check digit) and moving left, double every second digit; if doubling produces a number greater than 9, subtract 9 from it.",
      "Sum all the digits (doubled ones after the above adjustment, others unchanged).",
      "The number is valid if that sum is a multiple of 10.",
      "To compute a missing check digit: try each digit 0-9 appended to the given number until the resulting full number's Luhn sum is a multiple of 10; that digit is the check digit."
    ],
    "constants": [],
    "examples": [
      {
        "name": "worked example",
        "inputs": {
          "mode": "validate",
          "number": "4111111111111111"
        },
        "expected": {
          "answer": "true"
        },
        "check": "4111111111111111 is the widely published Visa test card number, well documented as passing the Luhn check; the algorithm confirms it is valid."
      },
      {
        "name": "test vector: compute check digit",
        "inputs": {
          "mode": "compute_check_digit",
          "number": "7992739871"
        },
        "expected": {
          "answer": "3"
        },
        "check": "7992739871 with check digit 3 (full number 79927398713) is the widely published worked example used to illustrate the Luhn algorithm; the computed check digit matches that published example."
      }
    ],
    "disclaimer": null,
    "deck_category": "other"
  },
  "status": "minted",
  "kind": "method",
  "provenanceClass": "own_question",
  "provenance": {
    "schema": "card_provenance/2.0.0",
    "chain": [
      {
        "source": {
          "kind": "standard",
          "value": "ISO/IEC 7812-1:2017, Identification cards - Identification of issuers - Part 1: Numbering system.",
          "retrieved_utc": "2026-09-30T20:01:00Z"
        },
        "sha256": "8331103aaa32285f7b21c6d48c6ca31c08d945fde3a8c623215eb8b2ee3f7776",
        "supersedes": null,
        "added_utc": "2026-09-30T22:39:30.722Z",
        "added_by": "method:Luhn check digit",
        "why": "the method that computed this answer",
        "check": null,
        "status_label": "pending",
        "signature": null
      }
    ]
  }
}
