+ 7
* Beginner Project Idea *
LYCHREL NUMBERS This only works on Non Lychrel #s Take a number, add it to its backward self, and the sum is checked to be or not to be a palendrome. if it is not, it runs again with its new number (the sum) and checks that. ultimately getting to a palendrome and revealing how many runs it took. if it fails, that was a Lychrel # example - 47 47 + 74 = 121 1 Try reveals a palendrome example #2 - 349 349 + 943 = 1292 1292 + 2921 = 4213 4213 + 3124 = 7337 3 Trys reveals a palendrome
12 Réponses
+ 11
https://code.sololearn.com/cq9Q13gtfY7r/?ref=app
you can take help from above link.
+ 9
c# plesae
+ 3
fun fact. 196 for instance has been run on a super computer over a billion iterations resulting in numbers over 400,000,000 digits long and still nothing.
+ 2
Great idea.
This is the code i made:
https://code.sololearn.com/caorAziv04Zk/#py
+ 1
cool idea
+ 1
As I have just started learning ruby i gave it a try:
Chech out my Code Lychrel
0
Get the number and convert to String using str(). Reverse the string using slice syntax [::-1]. Convert the reverse string to int using int(); Check if the initial number and the reverse number are equals. If not, increment the attempt and execute all again.
0
How I did it. Maybe not the best way, but it got me the result I needed.
run=True
def flip(x):
x=str(x)
x=x[::-1]
x=int(x)
return x
def check(a,b):
global trys
print(a, end=' ')
print("+", end=' ')
print(b, end=' ')
print("=", end=' ')
c=a+b
print(c)
d=flip(c)
if c == d:
print()
print("The Palendrome Is %d" % c)
print()
print("Solved in %d runs" % trys)
else:
trys+=1
check(c,d)
while run == True:
trys=1
print("\n"*2)
number=input("Enter A Number - ")
print(number)
print("\n")
numberFlip=flip(number)
number=int(number)
check(number, numberFlip)
0
nice
0
you want it in c#, write it in c# and show us. this is just a simple project for beginners.. I would like to see it in c#
0
Nice code Daniel!
0
Thank you guys very much I appreciate your kind help