Live data from Hacker News

Any positive number can be written as a sum of three palindromes

somethingorotherwhatever.com

111–114 of 114 posts

Re: Any positive number can be written as a sum of three palindromes

#111

Earlier quoted context omitted.

Yeah, for example to check if a number is divisible by 3, we can use the digit sum and check if the result is divisible by 3, e.g. 153=(1)+(5)+(3)=9. This works in base-10, but we can generalize this by converting the dividend X into (3* X+1)-base then doing a digit sum. Let's say we want to check whether 238 is divisible by 17, so our base is 3* 17+1=52, 238 in base-52 is (4)+(30)=34=2* 17. If the convert-to-arbitra…

Is it unreasonable to think that some operations might be cheaper to compute by the converting the base and applying these types of tests?

Referring specifically to divisibility tests, converting bases takes more work than just doing the division. What other operations were you thinking of?

Re: Any positive number can be written as a sum of three palindromes

#112

Why three? Anyone have a theory (or the answer)?

Well, there is a whole 40+ page paper on the algorithm and its proof of correctness. So, yes there is an answer. https://arxiv.org/abs/1602.06208

The intent of my question was an answer that doesn't require reading 40 pages of mathematics proof (and before that learning how to read 40 pages of mathematics proof).

Re: Any positive number can be written as a sum of three palindromes

#113
post #73
post #72

Earlier quoted context omitted.

There's a stronger generalization: it's true of any divisor of the base (not just prime divisors and not just proper divisors). For example, it works for divisibility by 6 in base 12, or divisibility by 10 in base 10. (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,…

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.

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 palindromes

#114
post #107

Earlier quoted context omitted.

IMHO that's like saying higher level programming languages than assembly are unnecessary. Or that a debugger is useless. And not just the learning purposes. Imagine the possibilities if we could properly simulate (and speed up the simulation) the world - what if we could use genetic algorithms to develop an organism.

> IMHO that's like saying higher level programming languages than assembly are unnecessary. Or that a debugger is useless. These two statements are quite different. Higher level programming languages than assembly are unnecessary; anything beyond the lambda calculus is unnecessary (assuming our goal is to compute Turing computable things). That's very different from saying that they're useless; just because they can…

I know that these statements are quite different, I deliberately made two different examples - one about creating and one about debugging. A world simulator is going to be a test environment for us as well as an introspection tool.
Post reply on HN