Skip to content
The Lumenary

Each worksheet prints cleanly on A4 or Letter. Answer keys are on a separate page.

The Lumenary · Grades 6–8

Check digits and error detection

Name: ______________________

Date: ______________________

You will learn to

  • Compute and verify ISBN-10 and ISBN-13 check digits
  • Prove that ISBN-10 detects every single-digit error and every swap of two neighbouring digits
  • Explain why ISBN-13 detects every single-digit error but misses swaps of neighbouring digits that differ by 5
  • Add a parity bit to binary data and prove that it detects any odd number of flipped bits and no even number
  • Explain why a single check digit can detect an error but cannot correct it
  1. 1.

    The first nine digits of an ISBN-10 are 9-97150-2139\text{-}97150\text{-}213. What is the check digit? (If it is X, answer 1010.)

  2. 2.

    Exactly one of these is a valid ISBN-13. Which one?

    • A.978-9966-25-118-3
    • B.978-9966-25-181-3
    • C.978-9966-52-118-3
    • D.978-9966-25-118-8
  3. 3.

    Find the check digit d13d_{13} of the ISBN-13 that begins 978-9966-25-118978\text{-}9966\text{-}25\text{-}118.

  4. 4.

    What parity bit should be added to the message 11010111101011 so that the total number of 1s is even? (Answer 00 or 11.)

  5. 5.

    Which swap of two neighbouring digits can go undetected in an ISBN-13?

    • A.…16…→…61…\ldots 16 \ldots \to \ldots 61 \ldots
    • B.…23…→…32…\ldots 23 \ldots \to \ldots 32 \ldots
    • C.…48…→…84…\ldots 48 \ldots \to \ldots 84 \ldots
    • D.…90…→…09…\ldots 90 \ldots \to \ldots 09 \ldots
  6. 6.

    In the proof that ISBN-10 catches every swap of neighbours, xx is in position kk and yy in position k+1k + 1. By how much does the swap change the check sum?

    • A.By y−xy - x (up to sign)
    • B.By k(y−x)k(y - x)
    • C.By 2(y−x)2(y - x)
    • D.By 00 — the sum does not change
  7. 7.

    One digit of a valid ISBN-10 is smudged: 3-16-14 ? 410-X3\text{-}16\text{-}14\,?\,410\text{-}X. The smudged digit is in position 66. Find it. (Hint: you will need a partner modulo 1111.)

  8. 8.

    A received ISBN-10 fails the check. Which statement is true?

    • A.At least one digit is wrong, but in general we cannot tell which one.
    • B.The computer can find and fix the wrong digit using the check digit.
    • C.The check digit itself must be the wrong digit.
    • D.Exactly one digit is wrong.
  9. 9.

    In Lean, a code number is a list of digits and pre ++ x :: post is the list pre, then the digit x, then the list post. Which statement says that ISBN-10 detects every single-digit error?

    • A.ValidISBN10 (pre ++ x :: post) → ValidISBN10 (pre ++ y :: post) → x = y (for digits x, y ≤ 10)
    • B.ValidISBN10 (pre ++ x :: post) → ¬ ValidISBN10 (pre ++ y :: post)
    • C.ValidISBN10 (pre ++ x :: y :: post) → ValidISBN10 (pre ++ y :: x :: post) → x = y
    • D.x ≠ y → ValidISBN10 (pre ++ x :: post)
  10. 10.

    Write luhn_valid(number), where number is a string of digits, returning True if it passes the Luhn test: from the right, keep the 1st, 3rd, 5th, … digits as they are; double the 2nd, 4th, … digits, subtracting 99 when the double is more than 99; the total must be a multiple of 1010. Then check the blind spot: 1099 and 1909 differ by a 09↔9009 \leftrightarrow 90 swap.

    Computational — Practice

Code: Apache-2.0 · Content: CC BY-SA 4.0