3 ms·
I like the graph-way of dividing by 7. It's not intuitive and it's not easy to remember, but at least it looks cool. http://imgur.com/wCE6z.png http://imgur.co
by JeanPierre 16y ago
I like the graph-way of dividing by 7. It's not intuitive and it's not easy to remember, but at least it looks cool.
http://imgur.com/wCE6z.png http://imgur.com/wCE6z.png
Start at 0. Read the number left to right, and for each digit D, go D black edges. Whenever moving from digit to another, go a red edge.
- radq 16y agoHow does this work?
- kwantam 16y agoIt's a deterministic finite automaton (state machine) for dividing by seven. In effect, it's the graph expansion of a regular expression. http://blog.vkistudios.com/index.cfm/2008/12/30/Regular-Expression-to-determine-if-a-base-10-number-is-divisible-by-3 http://blog.vkistudios.com/index.cfm/2008/12/30/Regular-Expr...
- eru 16y agoBy the way, at http://slexy.org/view/s2QFWeNxZo http://slexy.org/view/s2QFWeNxZo is a (horrible) regular expression you can pop into "grep -xe" to test decimal numbers for divisibility by 7. (Found with a Haskell programm I wrote via conversion from the DFA.)