+ 11

[challenge]🚂🚂🚂 that funny number🚂🚂🚂

input a 4-digit number where not all numbers are equal. Build the lowesr number from this 4 digits and build the highest number. build the difference. the difference is the new number. goon until number does not change. output that number. example: 6767 lowest 6677 highest 7766 difference 1088 lowest 0188 highest 8810 difference 8622 .... all languages welcome have fun

21st Nov 2017, 8:19 AM
Oma Falk
Oma Falk - avatar
34 Answers
+ 14
@Ferhat Oh my I'm so forgetful and just recalled I've completed similar challenge before this after seeing your post and @sayan's reply. 😲
21st Nov 2017, 11:02 AM
Zephyr Koo
Zephyr Koo - avatar
21st Nov 2017, 3:25 PM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 12
Interesting! Can you provide us an example where the loop halts after n iteration? Is it based on certain conjecture or theorem? 😉
21st Nov 2017, 9:17 AM
Zephyr Koo
Zephyr Koo - avatar
+ 11
@Batman here I already posted this. https://www.sololearn.com/Discuss/831398/?ref=app
21st Nov 2017, 9:45 AM
Ferhat Sevim
Ferhat Sevim - avatar
21st Nov 2017, 11:57 PM
AZTECCO
AZTECCO - avatar
21st Nov 2017, 2:24 PM
Justine Ogaraku
Justine Ogaraku - avatar
21st Nov 2017, 4:21 PM
Podretyz
Podretyz - avatar
+ 7
@sayan not bad! but you are a phemome to me! i really enjoy discussing with you
21st Nov 2017, 9:36 AM
Oma Falk
Oma Falk - avatar
+ 7
@Ferhat I recognized too late. as i posted before: it is worth to post it again
21st Nov 2017, 9:47 AM
Oma Falk
Oma Falk - avatar
+ 7
@ferhat thank you!
21st Nov 2017, 9:54 AM
Oma Falk
Oma Falk - avatar
+ 6
@sayan yes thats it i am not the firsr i see but it is good enough to repeat it
21st Nov 2017, 9:19 AM
Oma Falk
Oma Falk - avatar
+ 6
@Batman, No problem, it is refreshing mind when you see again. :)
21st Nov 2017, 9:53 AM
Ferhat Sevim
Ferhat Sevim - avatar
+ 6
friends ... we have a python recursion solution https://code.sololearn.com/cOjo4MnK79gm/?ref=app it is the special wish of the author to get many upvotes. we should try at least 10 can we do that?
21st Nov 2017, 7:15 PM
Oma Falk
Oma Falk - avatar
+ 5
lets try!
21st Nov 2017, 9:02 AM
Oma Falk
Oma Falk - avatar
+ 5
@sayan not completely wrong (-:
21st Nov 2017, 9:16 AM
Oma Falk
Oma Falk - avatar
+ 5
@sayan so... college student LOL thanks for all your contributions
21st Nov 2017, 9:28 AM
Oma Falk
Oma Falk - avatar
+ 5
lol 😂
21st Nov 2017, 7:16 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 4
heres mine... its called karpekar's constant... https://code.sololearn.com/cdJpN0RtPNnW/?ref=app
21st Nov 2017, 9:18 AM
sayan chandra
sayan chandra - avatar
+ 4
@sayan cool stuff! can you do it with recursion?
21st Nov 2017, 1:36 PM
Oma Falk
Oma Falk - avatar
+ 3
i assume.. 7766-6677=1089...
21st Nov 2017, 9:15 AM
sayan chandra
sayan chandra - avatar