I wrote some terrible python code to search divisibility rules for a given number and it tests example product divisibility
Edit2: https://pastebin.com/Dkbq2chV Yet another revision, I got caught up in this project but I think it has enough features now. I added few command line options and details you can edit in the script.
I need to stop before I add more features. Here's example output:
$ python ./findDivRules.py -h
python ./findDivRules.py [Integer or "(Start,End)"] [Show example? (0,1)]
[Example is divisible? (0,1)] [Parker style? (0,1)] [Rule count] [Rule index]
Default command : python ./findDivRules.py 313 True False True 10 0
Range example : python ./findDivRules.py "[1,11]" 0 0 1 2 0
$ python ./findDivRules.py 313 True True True
Found 3 rules for 313, showing first 10:
P N a b c P*N
313 16 5 3 8 5008
313 32 1 4 16 10016
313 639 2 5 7 200007
313 has following divisibility rule using B*a-A*c
Split the tested number into A and B after 3rd digit.
Multiply A by 8 and multiply B by 5
Subtract A from B = B*5-A*8
Example:
Using rules P=313 a=5 b=3 c=8
Testing 700807 divisibility by 313
A|B B*a-A*c Intermed
700|807 807*5-700*8 -1565
-2|435 435*5+2*8 2191
2|191 191*5-2*8 939
0|939 939*5+0*8 4695
Smallest iteration 939 = 313*3
700807 is divisible by 313