How to resolve the algorithm SEDOLs step by step in the J programming language

Published on 12 May 2024 09:40 PM
#J

How to resolve the algorithm SEDOLs step by step in the J programming language

Table of Contents

Problem Statement

For each number list of 6-digit SEDOLs, calculate and append the checksum digit.

That is, given this input: Produce this output: Check each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm SEDOLs step by step in the J programming language

Source code in the j programming language

sn   =.  '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'  
ac0  =:  (, 10 | 1 3 1 7 3 9 +/@:* -)&.(sn i. |:)


ac1  =:  (, 10 | (10 - 1 3 1 7 3 9) +/@:* ])&.(sn i. |:)


ac2  =:  (, 10 | 9 7 9 3 7 1 +/@:* ])&.(sn i. |:)


ac3  =:  (,"1 0 (841 $ '0987654321') {~ 1 3 1 7 3 9 +/ .*~ sn i. ])


  

You may also check:How to resolve the algorithm Pick random element step by step in the BaCon programming language
You may also check:How to resolve the algorithm Leap year step by step in the ALGOL W programming language
You may also check:How to resolve the algorithm Chowla numbers step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Animate a pendulum step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Averages/Arithmetic mean step by step in the Stata programming language