The Mosque Library 📖

It's day 14 of Ramadan, and there is a clear-up happening in the library section of the mosque. The books need organising, but there's an issue. Just before Ramadan, there was an intern helping out, and he has taken all the barcodes and re-entered the books into the system in a special coded system.

The intern was a wacky teenager working on creating a language of his own. We'll get back to that in a moment!

Barcode systems use what's known as a check digit to assess the validity of a barcode.

A check digit is a form of error-detection code used to verify a sequence of numbers. Every book has an ISBN.

An example ISBN could be 978-3-16-148140-0.

To check if an ISBN is valid using its check digit, here’s the process for a 13-digit ISBN like the one above.

  1. Remove hyphens:

ISBN becomes:

9783161481400.

  1. Take the first 12 digits (ignore the last digit for now):

9 7 8 3 1 6 1 4 8 1 4 0.

  1. Multiply digits alternately by 1 and 3:
    (9×1) + (7×3) + (8×1) + (3×3) + (1×1) + (6×3) + (1×1) + (4×3) + (8×1) + (1×3) + (4×1) + (0×3)

This equals 94:

    9 + 21 + 8 + 9 + 1 + 18 + 1 + 12 + 8 + 3 + 4 + 0

    = 94

  1. Compute the modulus:

This finds the remainder when dividing by 10.

ISBN-13 uses this to make sure the total ends in zero.

94 mod 10 = 4.

  1. Calculate the check digit:

- If the remainder (of x mod 10) is 0, the check digit = 0.

- Otherwise, check digit equals (10 - remainder)

- 10 - 4 = 6.

In the case above ,since 94 mod 10 = 4, the check digit equals 6 and so the ISBN is not a valid one since the 13th digit (0) is not 6.

Back to the intern!

The intern managed to log 1000 books into the system using his special coded language before his time ran out.

It seems that rather than use the base 10 numerals we are used to reading, the intern converted the numbers using a system of counting slashes.

every digit is represented by a number of forward slashes (/) or back slashes (\).

Oh! Apart from 0 which is always represented by a | symbol.

for example:

  • the numbers 123 have been written as:

/\\///

  • 725 has been written as ///////\\/////

  • 502 is represented as /////|\\

Brother Richard who runs The Beacen Mosque library has asked Mustafa to decipher the barcodes from the intern's language and then detect how many have incorrect barcodes.