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.
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?
(Also, the digital root test, where you add up the digits, works for any divisor that is also a divisor of the base minus 1, so for example hexadecimal has a digital root test for divisibility by 3, 5, or 15.)