It's a simple & fun math challenge. This small JS script will take a number from input, then add its reversed to it and will repeat this step till gets a palindrome as result (a number that is same with its reversed version. like: 1771)
example:
568(input)
+865(reversed input)
=1271
-->1271
+1721
=2992(palindrome)
- clone:
git clone https://github.com/xvyashar/js-palindrome.git
- install dependencies:
npm install
- run:
node index.js <input_number>
If you test some special numbers like 196
& 295
as input, you'll never reach to palindrome :)
Test them to see!