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 = 1 0 − ( ( d 1 + 3 d 2 + d 3 + 3 d 4 + ⋯ + d 1 1 + 3 d 1 2 ) m o d 1 0 )
Then,
d 1 3 = { r 0 if if r < 1 0 r = 1 0
Alice told Bob that she published a book with an ISBN of 9 7 8 1 4 0 0 8 2 8 6 7 8 . Is the ISBN number valid?
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.
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.)
Problem Loading...
Note Loading...
Set Loading...
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.
Since the output is true , the answer is Yes .