Re:Divisibility by 7 is a Walk on a Graph (2009)
by omaranto on Sunday November 08, 2015 @10:30PM
(#10531225)
Yes, it's easy: to test divisibility by n make a graph with n verities labeled 0 through n-1; put black arrows from each vertex k to (k+1) mod n; and put white arrows from each k to 10k mod n.
(That's for testing divisibility by n of numbers written in base 10; for others bases just replace the 10 above.)
(That's for testing divisibility by n of numbers written in base 10; for others bases just replace the 10 above.)