Whats wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Whats wrong?

https://code.sololearn.com/cf4pGGy1djm8/?ref=app Question: if the last digit of any number is moved in front of the number, it should be the double of the original number. Note: The solution has about 18 digits.

5th Nov 2021, 2:59 AM
Jakob
7 Answers
+ 4
The digit most right detemines all other digits. u need 8 tries since 0 and 1 cant be last digits. eg if last digit is 4, the last digit of double number must be 8. this is the second digit from left. so we have 84 now third from left must be 6 (2*8)%10 684 next (2*6+1)%10... 3684 next 73684 next 473684 next 9473684 ... https://code.sololearn.com/cOzuTRMzu43l
5th Nov 2021, 9:52 AM
Oma Falk
Oma Falk - avatar
+ 4
105263157894736842 157894736842105263 210526315789473684 263157894736842105 368421052631578947 421052631578947368 473684210526315789
5th Nov 2021, 10:20 AM
Oma Falk
Oma Falk - avatar
+ 3
Your code times out long before 18 digit numbers are reached.
5th Nov 2021, 3:21 AM
Simon Sauter
Simon Sauter - avatar
+ 3
Steve I don't know, I guessed. Nice challenge BTW.
5th Nov 2021, 12:27 PM
Oma Falk
Oma Falk - avatar
+ 3
What's the problem?
6th Nov 2021, 1:49 AM
CGO!
CGO! - avatar
+ 2
It seems the number are diferent...try with a narroe range https://code.sololearn.com/citVKyCa4ibk/?ref=app
5th Nov 2021, 3:18 AM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar
+ 1
Oma Falk After seeing your response I have to say that it's amazing to me that you even understood the question enough to know that was what was wanted. So doubly amazing on your part!
5th Nov 2021, 12:05 PM
Steve
Steve - avatar