{
  "address": "2c2db1d4d4075d8271d0337818070b40",
  "category": "other",
  "question": "What is the ISBN-10 check digit for 020161622?",
  "answer": "X",
  "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 2108 (the ISBN standard)",
      "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 2108:2017, Information and documentation - International Standard Book Number (ISBN).",
    "retrieved_utc": "2026-09-30T20:02:00Z"
  },
  "qsha256": "ce87aab5cfcad7225a1c70774343db20474037c34e474c639b38f572536d543f",
  "runOne": null,
  "cardContractVersion": "card_contract/1",
  "deck_id": "method-deck",
  "deck_title": "Method Deck",
  "method": {
    "name": "ISBN-10 / ISBN-13 check digit",
    "version": "1",
    "source_url_or_file": "methods/isbn-10-and-13-check-digit.cjs",
    "sha256_of_method_file": "2b79c94ede9d1bb3a1e1cd8821395a4459e2155011adf65c4207826c21863ad9"
  },
  "receipt": {
    "inSubstrate": false,
    "local": true,
    "modelCallsAtMint": 0,
    "tokensAtMint": 0
  },
  "method_deck": {
    "inputs": [
      {
        "name": "isbn_type",
        "type": "string",
        "required": true,
        "description": "Which ISBN format.",
        "enum": [
          "isbn10",
          "isbn13"
        ]
      },
      {
        "name": "operation",
        "type": "string",
        "required": true,
        "description": "Whether to validate a full ISBN or compute a missing check digit.",
        "enum": [
          "validate",
          "compute"
        ]
      },
      {
        "name": "digits",
        "type": "string",
        "required": true,
        "description": "For validate: the full 10 or 13 characters (ISBN-10 may end in X). For compute: the first 9 (isbn10) or 12 (isbn13) digits."
      }
    ],
    "outputs": [
      {
        "name": "result",
        "description": "For validate: true or false. For compute: the check digit/character."
      }
    ],
    "steps": [
      "ISBN-10: weight the 10 digits 10,9,8,...,1 (left to right); the sum of digit*weight must be a multiple of 11 for a valid ISBN. The check digit (10th digit) can be 'X', representing 10.",
      "To compute an ISBN-10 check digit from the first 9 digits: sum digit_i*(10-i) for i=0..8, then check = (11 - (sum mod 11)) mod 11; if check is 10, use 'X'.",
      "ISBN-13: weight the 13 digits alternately 1,3,1,3,...,1 (left to right); the sum of digit*weight must be a multiple of 10 for a valid ISBN.",
      "To compute an ISBN-13 check digit from the first 12 digits: sum digit_i*(1 if i even else 3) for i=0..11, then check = (10 - (sum mod 10)) mod 10."
    ],
    "constants": [],
    "examples": [
      {
        "name": "worked example",
        "inputs": {
          "isbn_type": "isbn10",
          "operation": "compute",
          "digits": "020161622"
        },
        "expected": {
          "answer": "X"
        },
        "check": "020161622 is the first 9 digits of the published ISBN 0-201-61622-X for 'The C Programming Language'; by hand, sum = 0*10+2*9+0*8+1*7+6*6+1*5+6*4+2*3+2*2 = 100, 100 mod 11 = 1, check = (11-1) mod 11 = 10 = X, matching the real published ISBN."
      },
      {
        "name": "test vector: ISBN-13 validate",
        "inputs": {
          "isbn_type": "isbn13",
          "operation": "validate",
          "digits": "9780306406157"
        },
        "expected": {
          "answer": "true"
        },
        "check": "9780306406157 is the widely published valid ISBN-13 example used to illustrate the EAN-13 check; by hand the weighted sum (weights 1,3 alternating) totals 100, a multiple of 10, so it is valid."
      }
    ],
    "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 2108:2017, Information and documentation - International Standard Book Number (ISBN).",
          "retrieved_utc": "2026-09-30T20:02:00Z"
        },
        "sha256": "fb2db7d4d389443388055f9690c91ecd8b2d4349ab9fab5bc1b3f09fd314159d",
        "supersedes": null,
        "added_utc": "2026-09-30T22:39:30.722Z",
        "added_by": "method:ISBN-10 / ISBN-13 check digit",
        "why": "the method that computed this answer",
        "check": null,
        "status_label": "pending",
        "signature": null
      }
    ]
  }
}
