Tripartite Palindromic Partition of Integer (HP 50g) Challenge
|
02-22-2023, 02:17 PM
Post: #25
|
|||
|
|||
RE: Tripartite Palindromic Partition of Integer (HP 50g) Challenge
(02-22-2023 09:07 AM)Werner Wrote: How do you know to take x 12 digits and not 13? If x is 13 digits, n = x + (y+z), y must be 12 digits = 10^12-1 Note: to avoid backtracking, we prefer odd digits y ... but, let's ignore this for now. n-y = (10^12+110002) - (10^12-1) = 110003 = x+z --> x cannot be 13 digits palindrome. If we force it anyway, we have a contradiction of x > n (palindrome x, first digit cannot be 0) Code: 0 0 0 0 0 0 0 1 1 0 0 0 3 (02-22-2023 09:07 AM)Werner Wrote: The '-5' underneath the 6, how do you know it has to be -5 and not 5? The goal is not to backtrack, whatever digits written all good. Code:
If ? = 5, we required carry, and backtracking(s) to correct for the changes. Code:
If ? = 5 - 10 = -5, we can just keep going ... Code:
Note that 8 - 6 = 8 - (7-1) --> next z=2, whether we backtrack with carry, or not. Both setup, unfilled digits are exactly the same. We can easily show this: Δx = [1, 1, ..., 1, 1] ≡ [0, b+1, ..., 0, b+1] // horner's rule with base b, gives same result To maintain same x+z, x of [0, 6] → [1, 7], required z of [7, 6] → [7, 6-11] = [7, -5] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)