Re: [QUIZ] Perl 'Hard' Quiz of the Week #2005-03-22
Greg Bacon <[email protected]> Wed, 23 Mar 2005 16:28:51 -0600
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Organization | Eric Conspiracy Secret Labs |
| Message-ID | <[email protected]> |
In message <200503221754.23325.shlomif-ik1l9ssToec+JF/[email protected]>, Shlomi Fish writes: : [...] : Your mission is to write a function - gen_is_divisable_fsm($N) - that : when given a non-even number $N will generate a state machine to : determine if a number represented by a sequence of binary digits : (starting from the least significant bit) is evenly divisable by $N. Should "least significant" be "most significant," or will the input bits really arrive in reverse order? I didn't notice this sentence until after I'd already completed an MSB-first implementation. It's interesting that the resulting automata are isomorphic to one another. That they do makes sense after you've seen it, but it wasn't an initial expectation. Greg