Finite state machine that accepts if sum of digits divisible by 3 .
I am trying to construct a finite state machine the accepts if the sum of digits is divisible by n. So far I was able to do for n=2 and n=3 but dint find any generalized steps that I could follow. Any help is appreciated.