HP Forums

Full Version: how to tell if a number is a palindrome, 17bii solver
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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))$$
Reference URL's