Re:Testing for Divisibility by 19
by ngcc_hk on Monday November 23, 2020 @05:32AM
(#25185352)
Great. Hope there is a simple math proof before someone write this into a cobol or s/370 assembler routine to save their time :-)
[ Parent
| on HN ]
The main idea behind it is that adding 19 to a number is the same as adding 20, then subtracting one.
So, most of the time, it adds 2 to the ‘tens’ column, and subtracts 1 from the units column. Twice that -1 plus that 2 equals zero, which is divisible by 19.
When it doesn’t, it adds 1 to the tens column and 9 to the ones column. Twice that 9 plus that 1 equals 19, which also is divisible by 19.