Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numbers in Our Pockets GCNU 1025 Numbers Save the Day.

Similar presentations


Presentation on theme: "Numbers in Our Pockets GCNU 1025 Numbers Save the Day."— Presentation transcript:

1 Numbers in Our Pockets GCNU 1025 Numbers Save the Day

2 Numbers in our pockets A fundamental use of numbers: counting

3 Numbers in our pockets How about banknotes?

4 Numbers in our pockets ID number for identifying/tracking banknotes

5 Numbers in our pockets ID number for identifying/tracking banknotes

6 1. Numbers for identification An ID (identification) number is a string of numbers that is used for identification. It enables us to recognize the object or person attach to that number. Examples: Postal codes Phone numbers Country codes Numbers in cheques

7 Postal Codes A post code (or post code, postcode, ZIP code) is a series of letters and/or numbers appended to a postal address (or a delivery route). Different countries with different systems. Postal codes allow us to recognize the geographical area to which the code refers.

8 ZIP code in the address of Harvard University: MA 0213802138 Some more specific ZIP codes have 4 extra digits (“ZIP+4”)

9 ZIP codes of US

10 Chinese postal codes 6 digits (e.g. 518053) 4 levels: 51-8-0-53 – First 2 digits: province/municipality/autonomous region – 3rd digit: postal zone – 4th digit: district – Last 2 digits: local post office

11 Phone numbers for identification

12 Hong Kong telephone numbers Which are fixed land line numbers? How can you tell? A.2363 2767 B.3411 2801 C.5589 4120 D.6583 2042 E.7729 1502 F.8320 1529 G.9258 4981

13 Hong Kong telephone numbers Number of a church: 2363 2767 363 xxxx: before 01/01/1995 Where is the church? Kowloon? Hong Kong Island? New Territories? Outlying Islands? How can you tell?

14 Hong Kong telephone numbers Where is the church? Kowloon? Hong Kong Island? New Territories? Outlying Islands? How can you tell? 363 2767: a number in Kowloon 1970s: (3)63 2767 – First “3”: area code for Kowloon – 632767 was the actual number – No need to dial the area code if you are in Kowloon

15 Hong Kong telephone numbers The leading digits of a Hong Kong telephone number are partially related to the location of the telephone line

16 Country codes How can a friend of yours from the US call you? Can he/she just dial your number? Need to dial 852 before the number (and probably also the number provided by the service provider)

17 Numbers for identification Why can’t a Hong Kong number be 99920842? Can the country code of China be 85? Example: 8526543210 – Interpretation #1: 852-6543210 (Hong Kong) – Interpretation #2: 85-26543210 (not Hong Kong) Prefix property: – No phone number (country code) can be the prefix of another phone number (country code)

18 Numbers in Cheques Cheque number, routing/transit number for issuing bank/branch, account number

19 Numbers in Our Pockets GCNU 1025 Numbers Save the Day

20 2. Numbers for error-checking Some identification numbers include error-checking features to enable us to check their validity. Examples: HKID card numbers Credit card numbers Warning: designed to detect errors rather than to prevent fraud.

21 HKID card numbers Some basics about HKID card numbers Check digits of HKID card numbers

22 Validity of Y123456(9) Rule: every valid HKID number has a special property Step 1 (of checking validity): Step 2 (of checking validity): Step 3 (of checking validity): is this “check sum” 286 divisible by 11? YES! The number is valid!

23 Classwork 1: validity of HKID number Have a try checking your own HKID….

24 A missing digit of a valid HKID number Y123464* x87654321 =2007121516188* If Y123464(*) is valid, what is “*”? Step 1: Step 2: – Check sum = 276 + * (which is known to be divisible by 11) – What should “*” be? Can “*” be 0-9? – If Y123464(*) is valid, “*” has to be 10! – Use “A” to represent 10 (recall the base 16 arithmetic)

25 HKID card check digit Weighted modulo 11 check: check digit appended to make check sum divisible by 11 0-9 or A (representing 10) Using “A” for “10” is not uncommon in other numeral systems (compare: base 16 numbers such as “B1A”)

26 HKID card check digit - Review Weighted modulo 11 check: check digit appended to make check sum divisible by 11 0-9 or A (representing 10) Using “A” for “10” is not uncommon in other numeral systems (compare: base 16 numbers such as “B1A”)

27 http://www.cp.hk/dbpub/idcheck.asp http://www.cp.hk/articles/identity.asphttp://www.cp.hk/articles/identity.asp Quote: Incidentally, the last character in brackets ( ) is actually not part of the HKID. It is a check digit which depends on the characters in the HKID, resulting between 0-9 or A. It is generated by a fairly simple formula, and is used to check for errors, because if you get one character wrong in the ID, then the check digit will be wrong. You can use our new online HKID check digit generator to calculate the check digit of any HKID - try it and see! Hours of fun for all the family.online HKID check digit generator HKID card check digit - Review

28 Place value: base 10 system Every digit must be from 0-9 (e.g. 1985) For a base 10 number “1985”: DigitValue of the positionActual value 11,000 (10x10x10)1,000 9100 (10x10)900 810 (10)80 515

29 Place value: base 16 system Base 16: every digit must be from 0-15 For a base 16 number “3A24”: 101112131415 ABCDEF DigitValue of the positionActual value 34096 (16x16x16)12,288 A (10)256 (16x16)2,560 216 (16)32 414

30 Other numeral systems Numeral systemDigits from Base 100-9 Base 160-15 Base 600-59 Base 120-11 Base 20-1 Base 80-7

31 Duodecimal system

32 Hexadecimal system

33 Sexagesimal system Stems-and-branches

34 Numeral systems Numeral systemUses Binary (base 2)Computers Octal (base 8)Used to be popular in Central America Duodecimal (base 12)1 foot = 12 inches Hexadecimal (base 16)1 pound = 16 ounces Sexagesimal (base 60)1 minute = 60 seconds

35 Number for error-checking: remarks Not for fraudulence prevention – Schemes known to public – A counterfeit (i.e. a fake) could still have a valid number – Other schemes available for such purpose

36 Numbers in Our Pockets GCNU 1025 Numbers Save the Day

37 Credit card check scheme Weighted modulo 10 check: check digit (i.e. last digit) appended to make check sum divisible by 10 How to calculate the check sum? How are the digits weighted?

38 Validity of 5424 7171 3312 0044 Rule: every valid credit card number has a special property Step 1 (of checking validity): Step 2 (of checking validity): Step 3 (of checking validity): Is this “check sum” 50 divisible by 10? YES! The number is valid!

39 Credit card check scheme

40 Luhn algorithm http://en.wikipedia.org/wiki/Luhn_algorithm See also “bank card numbers” http://en.wikipedia.org/wiki/Bank_card_numberhttp://en.wikipedia.org/wiki/Bank_card_number

41 Classwork 2: validity of credit card number Why not try the credit cards in your own pocket?

42 Numbers in Our Pockets GCNU 1025 Numbers Save the Day

43 3. Barcodes A 1D barcode is a series of dark bars and light spaces that represent characters/data. A scanning device is needed to pass over the bars and spaces to read the data. Examples: UPC barcodes (1D) QR codes (2D) Error-correcting feature of QR codes

44 UPC (barcode) check scheme A (one-dimensional) barcode represents data by varying the width and the spacing of parallel lines Primary example: Universal Product Code (UPC)

45 UPC (barcode): basic features 12-digit 1st digit: product category Last digit: check digit PrefixCategory 0, 1, 6, 7 or 8Ordinary products 2Variable-weight products 3Drugs 5 or 9Coupons

46 UPC (barcode): basic features Two sides separated watersheds/long guard bars Total width of strips representing a number is 7 Total width of black strips is odd (left side) – Example: 8 (WBBWBBB)

47 UPC (barcode): basic features Bars on two sides are like inverses. Bars on the right becomes spaces on the left and vice versa. – Example: the left representation of 8 is (WBBWBBB) and the right representation of 8 is (BWWBWWW) Odd width for left and even for right: enables scanners to detect orientation (up-side-down?)

48 UPC (barcode) check scheme Weighted modulo 10 check: check digit appended to make check sum divisible by 10 How to calculate the check sum? How are the digits weighted?

49 Validity of 9-87654-32109-8 Rule: every valid UPC number has a special property Step 1 (of checking validity): Step 2 (of checking validity): 27+8+21+6+15+4+9+2+3+0+27+8=130 Step 3 (of checking validity): Is this “check sum” 130 divisible by 10? YES! The number is valid! 987654321098 x313131313131 =2782161549230278

50 Classwork: validity of UPC number

51 Two-dimensional barcodes Limited amount of data stored in 1D barcodes such as UPC 2D barcode: rectangles (of different sizes) instead of strips (of different widths) Primary example: QR (quick response) codes

52 QR code: basic features Storage capacity depends on data type, dimension and error-correction level – 40 different dimensions – 4 levels of error correction power http://en.wikipedia.org/wiki/QR_codehttp://en.wikipedia.org/wiki/QR_code Play it! Error-correction level% of info that can be restored Level L (Low)~7% Level M (Medium)~15% Level Q (Quartile)~25% Level H (High)~30%

53 QR Code: Online Generator http://www.yj580.com/qr/

54 Numbers in Our Pockets -End-


Download ppt "Numbers in Our Pockets GCNU 1025 Numbers Save the Day."

Similar presentations


Ads by Google