[npl] / trunk / NationalProblemLibrary / Rochester / setDiscrete6Integers / ur_dis_6_9.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Rochester/setDiscrete6Integers/ur_dis_6_9.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 443 - (download) (annotate)
Tue Jun 26 21:45:47 2007 UTC (5 years, 10 months ago) by jjholt
File size: 1839 byte(s)
Updated tags. --JJH

    1 ## DESCRIPTION
    2 ##   Modular Arithmetic Application
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('Mod', 'Modular', 'ISBN')
    6 ## Tagged by nhamblet
    7 
    8 ## DBsubject('Discrete Mathematics')
    9 ## DBchapter('Number Theory')
   10 ## DBsection('Modular Arithmetic')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('Rochester')
   14 ## TitleText1('Discrete Mathematics')
   15 ## EditionText1('')
   16 ## AuthorText1('Rosen')
   17 ## Section1('2.3')
   18 ## Problem1('47,48')
   19 
   20 DOCUMENT();        # This should be the first executable line in the problem.
   21 
   22 loadMacros(
   23 "PG.pl",
   24 "PGbasicmacros.pl",
   25 "PGanswermacros.pl",
   26 );
   27 
   28 TEXT(beginproblem());
   29 $showPartialCorrectAnswers=1;
   30 
   31 
   32 do {
   33  $sum = 0;
   34  $sumb = 0;
   35  for ($i = 0; $i < 9; $i++) {
   36   $a[$i] = random(0,9);
   37   $sum = $sum + ($i+1)*$a[$i];
   38   $b[$i] = random(0,9);
   39   $sumb = $sumb + ($i+1)*$b[$i];
   40  }
   41 
   42  $q = $sum % 11;
   43  $qb = $sumb % 11;
   44 } until (($q < 10) and ($qb < 10));
   45 
   46 BEGIN_TEXT
   47 Books are identified by an International Standard Book Number (ISBN), a
   48 10-digit code \( x_1x_2\dots x_{10} \), assigned by the publisher. These
   49 10 digits consist of blocks identifying the language, the publisher,
   50 the number assigned to the book by its publishing company, and
   51 finally, a 1-digit check digit that is either a digit or the letter X
   52 (used to represent 10). This check digit is selected so that
   53 \( \sum_{i=1}^{10} ix_i \equiv 0 \text{ mod } 11 \) and is used
   54 to detect errors in individual digits and transposition of digits.
   55 $BR
   56 $BR
   57 (a) The ISBN for a book is \($a[0]-$a[1]$a[2]-$a[3]$a[4]$a[5]$a[6]$a[7]$a[8]-
   58 \text{Q} \)
   59  where Q is the check digit.
   60 What is Q?
   61 \{ ans_rule(30) \}
   62 $PAR
   63 (b) The ISBN of another book is
   64 \($b[0]-$b[1]$b[2]$b[3]-$b[4]$b[5]\text{M}$b[7]$b[8]-$qb \).  Find the digit M.
   65 \{ ans_rule(30) \}
   66 END_TEXT
   67 
   68 ANS(num_cmp($q) );
   69 ANS(num_cmp($b[6]) );
   70 
   71 
   72 ENDDOCUMENT();        # This should be the last executable line in the problem.;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9