Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
radq
on Oct 31, 2010
|
parent
|
context
|
favorite
| on:
Divisibility by 7
How does this work?
kwantam
on Oct 31, 2010
[–]
It'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-Expr...
eru
on Nov 2, 2010
|
parent
[–]
By the way, at
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.)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: