Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
A reference or a source of this information would really help.

3-Weight Method
The 3-Weight Methods is also known as the Electronic Funds Transfer Routing Number Scheme used by the banking industry. It is a mod 10 based system, but rather than operating on n as a whole number, it operates on a dot product (i.e., the individual digits of the number n).

So, given an 8 digit routing number, the check digit c = n · (7, 3, 9, 7, 3, 9, 7, 3), mod 10. Stated another way, let ai be the ith digit of n (most significant to least significant). Then

c = 7a1 + 3a2 + 9a3 + 7a4 + 3a5 + 9a6 + 7a7 + 3a8 mod 10

c is then concatenated to the 8 digit route, forming a 9 digit routing number

This scheme is based on the fact that multiplication modulo 10 yields a permutation of the 10 decimal digits if the multiplication factor is a digit of the set { 1, 3, 7, 9 }; but only a subset of the decimal digits if the factor is 5 or an even digit. This system cannot detect adjacent transpositions of digits that differ by 5.

The 3-Weight method does not use simple modular reductions, so c = 10 - c is not needed to hold the equality.

The reader should find the following check equation holds true (where a9 is -c):

0 = 7a1 + 3a2 + 9a3 + 7a4 + 3a5 + 9a6 + 7a7 + 3a8 + a9 mod 10

The 3-Weight Scheme is presented below. As the reader can see, it generalizes to a arbitrary length of digits easily. However, if the reader desires a system for very long datasets, or binary data sets consider using a CRC or Alder checksums, or a hash-based checksum.

What I have tried:

yes

I have tried but I have not been successful in obtaining the source of this information apart from this website. Has the 3 - weight method been studied before? Kindly point me in the right direction so that I can read more about it.
Posted
Updated 26-Oct-18 3:53am

1 solution

The formula is relatively easy to calculate the check digit.

The routing number is an 8 digit number, and digit number 9 is the check digit. In my example I will be using the variables d1-d9 to represent the individual digits

To calculate the check digit:
int d9 = 3(d1+d4+d7) + 7(d2+d5+d8) + 1(d3+d6+d9) MOD 10

To validate the number:
bool IsValid = (3(d1+d4+d7) + 7(d2+d5+d8) + 1(d3+d6+d9) MOD 10  = 0)

More Info: ABA routing transit number - Wikipedia[^]
 
Share this answer
 
v2
Comments
Richard MacCutchan 26-Oct-18 11:46am    
d6 seems to be missing. Presumably from the last sum.
MadMyche 26-Oct-18 11:49am    
Confirmed & fixed. Thank You. Bad typing day.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900