Project Euler 55 - Lychrel Numbers
Official link: https://projecteuler.net/problem=55
Thought Process
I have 2 functions
ispalindrome(x)
Pretty self explanatory function, returns True if x is a palindrome, returns False if it is not
compute(limit)
This function will find all lychrel numbers less than limit by finding all the non-lychrel-numbers
It's a brute force way, I check all numbers from 1 to limit while updating the number
I do a quick check to see if the number I am currently checking is a palindrome, if it is I move it one step forward and add its reverse to it
Then I have a for loop, which simply adds the reverse to a number 50 times, until it is a palindrome in which case I add 1 to the count of non-lychrel-numbers and break the loop.
After everything is done I return (limit - non-lychrel-numbers)
Interactive Code
Input an integer (yourinput)
Code will output the number of lychrel numbers < yourinput