Tripartite Palindromic Partition of Integer (HP 50g) Challenge
|
02-22-2023, 05:21 PM
(This post was last modified: 03-14-2023 05:07 PM by Albert Chan.)
Post: #26
|
|||
|
|||
RE: Tripartite Palindromic Partition of Integer (HP 50g) Challenge
(02-22-2023 02:17 PM)Albert Chan Wrote: Note: to avoid backtracking, we prefer odd digits y ... but, let's ignore this for now. Here is an example to show the reason for preferring odd y digits. n = 80818283828586878 // similar to OP example, but not quite. (n, 17 digits) = (x, 17 digits) + (y+z, both 16 digits) n - (10^16-1) = 70818283828586879 = x + z Code: 7 0 8 1 8 2 8 3 8 2 8 5 8 6 8 7 9 Note that x is not a valid palindrome, and require backtracking to fix. Top half of x (no center) = 67813794 - 1 = 67813793 [1, 2, 1] ≡ [0, b+2, 1] ≡ [0, b+1, b+1] // horner's rule with base b, gives same result To maintain same x+z, x of [4, 10] → [3, 8], required z of [-1, -2] → [-1, -2+11] = [-1, 9] 80818283828586878 = 67813793839731876 + 9999488998849999 + 3005000990005003 (n, 17 digits) = (x, 17 digits) + (y+z, both 15 digits) n - (10^15-1) = 79818283828586879 = x + z Code: 7 9 8 1 8 2 8 3 8 2 8 5 8 6 8 7 9 With odd y digits, no backtracking required 80818283828586878 = 79636957575963697 + 979295949592979 + 202030303030202 Another way, still keeping digits(y) odd, n = (x+y) + z 80818283828586878 - 69999999999999996 = 10818283828586882 Code: 1 0 8 1 8 2 8 3 8 2 8 5 8 6 8 8 2 80818283828586878 = 58813000100031885 + 19999694949699991 + 2005588778855002 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)