Missing Book

An ISBN is a code used to identify a book uniquely. It consists of 13 decimal digits. What's interesting is its last digit that is computed using the formula

r = 10 ( ( d 1 + 3 d 2 + d 3 + 3 d 4 + + d 11 + 3 d 12 ) m o d 10 ) r = 10 - ((d_1+3d_2+d_3+3d_4+\dots + d_{11} + 3d_{12}) \mod 10)

Then,

d 13 = { r if r < 10 0 if r = 10 d_{13} = \begin{cases} r & \quad \text{if } & \quad r < 10 \\ 0 & \quad \text{if } & \quad r = 10 \end{cases}

Alice told Bob that she published a book with an ISBN of 9781400828678 9781400828678 . Is the ISBN number valid?

Yes Not sufficient information No

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Jesse Nieminen
Oct 9, 2016

Following python code returns true is the inputted ISBN (as a string) is valid an false otherwise.
Error happens if the ISBN contains non-numeric characters.

1
2
3
4
5
6
7
def validate(isbn):
  if len(isbn) != 13:
    return False
  r = 0
  for i in range(0,len(isbn)-1,2):
    r -= int(isbn[i]) + 3*int(isbn[i+1])
  return int(isbn[-1]) == r % 10

Since the output is true , the answer is Yes \boxed{\text{Yes}} .

A simple substitution into the formula (in the head (adding the digits in the odd positions (except 13th) and in the even positions separately, multiplying the sum of evens by 3 + add the sum of the digits in the odd positions, take away the last decimal digit of this from 10 and comparing it with the 13th digit), on paper or by using a handheld calculator does the same trick in much less time, than writing this code (if we only have 1 ISBN number to check).

The problem is, that we cannot say from the information given, that the ISBN number is valid, just that it might be valid.

ISBN numbers are only valid if they have been issued already (e.g. the ISBN number of a book which has been first published in 2016 wasn't valid in 2011, even if it would have passed this check in 2011 as well.)

Zee Ell - 4 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...