Post Reply 
HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
09-11-2022, 01:30 AM
Post: #1
HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
Palindromic numbers read the same forwards and backwards. For example, 66, 121, 79497, etc.

Problem Description: If you add any positive integer to the integer formed by reversing its digits, then repeat the process with the resulting sum, and keep repeating this loop... will you eventually reach a sum that is palindromic?

Input: a non-decimal number between 1 and a 10-digit number on the RPN machine or between 1 and a 12-digit number on the RPL machine.

Output: Two items: The resulting palindromic number and the number of additions / cycles required to reach it. Place the number in stack level 1 (or X) and number of cycles in level 2 (or Y). If the input number does not reach a palindromic sum within 50 cycles or if an intermediate sum exceeds the digit capacity of the machine being used (10 digits on the HP-41 or 12 digits on the RPL class machines), return a 0 in level 1 (X) and 0 in level 2 (Y). If it is going to overflow the non-scientific notation capacity of the machine, return a 0 in both stack levels.

Winning routine:
Smallest BYTE routine that solves the input cases. If something takes forever in the judge’s mind to run, it can be eliminated at the judge’s sole discretion.

Sample Cases:
(A) 51. This turns into 66 in one step. 51+15 which is palindromic. Output is 66 in X and 1 in Y.
(B)59. This turns into 1111 in 3 steps. 59+95=154. 154+451=605. 605+506=1111. Output is 1111 in X and 3 in Y.
(C) 99. This reaches the palindromic value of 79497 in six steps. Output is 79497 in X and 6 in Y.

Machines Eligible:
RPN: Any machine running vanilla HP-41CX functionality. If a function isn’t in the HP-41CX it is not eligible.
RPL: The HP-50G built-in functionality, no libraries attached, nothing extra. Vanilla.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL - Gene - 09-11-2022 01:30 AM



User(s) browsing this thread: 1 Guest(s)