Re:Any positive number can be written as a sum of three pali...
by dmurray on Tuesday September 18, 2018 @12:30PM
(#18016668)
And the less well known "add and subtract alternative digits" works for dividing by 11, that is, the base plus one, in any base. And for any divisors of 11.
[ Parent
| on HN ]
Re:Any positive number can be written as a sum of three pali...
by taejo on Wednesday September 19, 2018 @08:26AM
(#18023655)
And much more generally, "numbers divisble by n written base b" is a regular language decidable by an n-state DFA (and thus in linear time, looking at each digit exactly once). And see https://blog.plover.com/math/divisibility-by-7.html for a state machine that's even simpler (you only need edges for +1 and ×b, rather than +d×b for each digit d)
Re:Any positive number can be written as a sum of three pali...
by QuercusMax on Tuesday September 18, 2018 @01:08PM
(#18017052)
You mean any divisors of [base + 1], right?