HP Forums
how to tell if a number is a palindrome, 17bii solver - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: how to tell if a number is a palindrome, 17bii solver (/thread-7760.html)



how to tell if a number is a palindrome, 17bii solver - Don Shepherd - 02-12-2017 02:00 AM

Of course you can just look at a number and tell if it is a palindrome, but I thought it would be neat to write a solver equation to do it. Enter the number as NUM and solve for ANS. If the number you entered is, in fact, a palindrome, it returns the number of matched pairs of digits (5665 would be 2 pairs matched, 47974 would also be 2 pairs matched, with the 9 middle digit being ignored). If the number you entered is not a palindrome, it will beep and display "Solution not found".

$$ANS=0{\times}L(A:IP(LOG(NUM)))+{\Sigma}(I:1: (G(A)+1){\div}2:1:IF(IP(10{\times}FP(NUM{\div}(10^I)))=IP(10{\times}FP(NUM{\div}​(10^{(G(A)+2-I)}))):1:NUM{\div}0))$$