How to resolve the algorithm ISBN13 check digit step by step in the J programming language

Published on 12 May 2024 09:40 PM
#J

How to resolve the algorithm ISBN13 check digit step by step in the J programming language

Table of Contents

Problem Statement

Validate the check digit of an ISBN-13 code:

You might use the following codes for testing:

Show output here, on this page

Let's start with the solution:

Step by Step solution about How to resolve the algorithm ISBN13 check digit step by step in the J programming language

Source code in the j programming language

   D            =:  '0123456789'
   
   isbn13c      =:  D&([ check@:i. clean)
     check      =:  0 = 10 | lc
       lc       =:  [ +/@:* weight
         weight =:  1 3 $~ #
     clean      =:  ] -. a. -. [


   isbn13c;._1 ' 978-1734314502 978-1734314509 978-1788399081 978-1788399083'
1 0 1 0


  

You may also check:How to resolve the algorithm CSV to HTML translation step by step in the Scala programming language
You may also check:How to resolve the algorithm Bulls and cows step by step in the Raku programming language
You may also check:How to resolve the algorithm Fermat pseudoprimes step by step in the Perl programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm Abelian sandpile model step by step in the RPL programming language