You are on page 1of 6

MODULAR ARITHMETIC

DEFINITION: The notation a mod n = r is equivalent to the notation a  r (mod n).


• It means “the remainder when a is divided by n”.
• a  r (mod n) is read as “a is congruent to r modulo n”

a mod n = r and a  r (mod n) are equivalent to “a = nq + r”


Example: 18 mod 7 = 4  18  4 (mod 7)  18 = 7(2) + 4
APPLICATIONS OF MODULAR ARITHMETIC:
• International Standard Book Number (ISBN)
• Universal Product Code (UPC)
• Credit Card Numbers
I. International Standard Book Number (ISBN)

• The International Standard Book Number (ISBN) is a unique numeric commercial book
identifier based upon, the 9-digit Standard Book Numbering (SBN) code which was
created by Gordon Foster in 1966.

An International Book Number consists of 4 parts (if it is a 10-digit ISBN) or 5 parts (for a 13-
digit ISBN):
1. For a 13-digit ISBN, a prefix element- so far 978 or 979 are the only ones available.
2. The registration group element: (language-sharing country group, individual country or
territory)
3. The registrant element
4. The publication element
5. The check digit

EXAMPLE 1: ISBN 0-8218-2626-X


• 0 represents the book was published in either the USA, UK, Australia, NZ, or Canada
• 8218 identifies the publishing company (American Mathematical Society)
• 2626 the number that is given to each book the corresponding company publishes; the
book should be the 2,626th book that was published by the AMS since the introduction
of ISBN.
• X, is the check digit; it is the same as the number 10.
EXAMPLE 2: ISBN 978-621-4141-55-5
• 978 is the prefix element; it used to refer to the country of origin of a product. 978
refers to a fictitious country of Bookland
• 621 is the registration group element; it refers to the country, geographical area or
language area of the book. It is identical to the group identifier in a 10-digit ISBN.
• 4141 is the registrant element and refers to the publisher or imprint issued that
identifier within the registration group. It is the same as the publisher identifier in a 10-
digit ISBN.
• 55 is the publication element and refers to the specific publication by that registrant
within that registration group. It is the same as the title identifier in a 10-digit ISBN.
• 5 is the check digit and performs the same function as the check digit in a 10-digit ISBN,
and is calculated in a similar way, with some major detail differences.

FORMULAS:
• For a 10-digit ISBN, the 10-digit codeword satisfies
𝒙𝟏 + 𝟐𝒙𝟐 + 𝟑𝒙𝟑 + ⋯ + 𝟗𝒙𝟗 + 𝟏𝟎𝒙𝟏𝟎 ≡ 𝟎 (𝒎𝒐𝒅 𝟏𝟏).
• For a 13-digit ISBN, the 13-digit codeword satisfies
𝒙𝟏 + 𝟑𝒙𝟐 + 𝒙𝟑 + 𝟑𝒙𝟒 ⋯ + 𝟑𝒙𝟏𝟎 + 𝒙𝟏𝟏 + 𝟑𝒙𝟏𝟐 + 𝒙𝟏𝟑 ≡ 𝟎 (𝒎𝒐𝒅 𝟏𝟎).

II. Universal Product Code (UPC)

The Universal Product Code (UPC), is a type of code printed on retail product
packaging. A UPC consists of 12-digit numbers with a corresponding machine-
readable bar code. The Uniform Code Council (UCC) is responsible for generating and
issuing unique product UPC’s to ensure that each code is unique. The digits or
barcodes can be broken down into four different components with each component
having a different function.
DIFFERENT COMPONENTS OF A BAR CODE
• 1st digit = product’s Number System Character (NSC); it specifies in which category a
product will be classified. The NSC codes are as follows:
0 assigned to all items except those below:
2 assigned to random weight items such as meat and poultry
3 assigned to companies identifying their NSC number as their UPC
4 assigned for retailer use only
5 assigned to coupons
6 & 7 assigned to industrial applications and retailer applications
• 2 -6 digits = the manufacturer’s number which is assigned by the UCC (Uniform Code
nd th

Council).
• 7th-11th digits = item code number. This is assigned and controlled by the member
company.
• 12th or the last digit = the check digit

EXAMPLE:

• 0 = product’s Number System Character (NSC)


• 12345 = the manufacturer’s number which is assigned by the UCC (Uniform Code
Council)
• 67890 = item code number
• 5 = check digit

*The Uniform Code Council (UCC) phased out the UPC coding in the year 2005 and
adopted the European Article Number (EAN) which is utilized by the rest of the world.

FORMULA:
• For a 12-digit UPC, the 12-digit codeword satisfies
𝟑𝒙𝟏 + 𝒙𝟐 + 𝟑𝒙𝟑 + 𝒙𝟒 ⋯ + 𝒙𝟏𝟎 + 𝟑𝒙𝟏𝟏 + 𝒙𝟏𝟐 ≡ 𝟎 (𝒎𝒐𝒅 𝟏𝟎).
III. CREDIT/DEBIT CARD NUMBERING

All credit and debit cards have numbers printed on them (generally 16 digits). This
signifies a unique account number for a card and reveals some information about the
card issuer and its associated account. For obvious reasons, just any randomly
generated numbers will not work, they follow a pattern.

In a typical sixteen-digit credit card number, the first fifteen digits are determined by
the issuing bank, but the last digit, called the check digit, is mathematically
determined based on all other digits.

The exact mathematics formula for its generation was invented by Hans Peter Luhn, an
engineer at IBM in 1954. Originally patented, the algorithm is now in the public domain and a
Worldwide standard ISO/IEC 7812–1.

The Luhn Algorithm or modulo-10 Algorithm


The Luhn algorithm is based around the principle of modulo arithmetic and digital roots.
1. Start from the rightmost digit (i.e. check digit)
2. Multiply every second digit by 2 (i.e. digit at even positions)
3. If the result in step 2 is more than one digit, add them up (E.g. 12: 1+2 = 3)
4. Add the resulting digits to digits at the odd positions
FORMULA:

• For a 16-digit credit card number, the 16-digit codeword satisfies

𝟐𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 + ⋯ + 𝟐𝒙𝟏𝟏 + 𝒙𝟏𝟐 + ⋯ + 𝟐𝒙𝟏𝟓 + 𝒙𝟏𝟔 ≡ 𝟎 (𝒎𝒐𝒅 𝟏𝟎).

You might also like