+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

11/21/2017 8:19:52 AM

Oma Falk

+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. π²

+14

https://code.sololearn.com/ckk6gxN5dV5B/?ref=app

+12

Interesting! Can you provide us an example where the loop halts after n iteration? Is it based on certain conjecture or theorem? π

+11

@Batman here I already posted this. https://www.sololearn.com/Discuss/831398/?ref=app

+10

My try.. https://code.sololearn.com/cZnTeOC3LNNa/?ref=app

+8

Check mine. is it correct? https://code.sololearn.com/cOjo4MnK79gm/?ref=app

+8

Is it Correct? https://code.sololearn.com/c0sTXd9ncNfi/?ref=app

+7

@sayan not bad! but you are a phemome to me! i really enjoy discussing with you

+7

@Ferhat I recognized too late. as i posted before: it is worth to post it again

+7

@ferhat thank you!

+6

@sayan yes thats it i am not the firsr i see but it is good enough to repeat it

+6

@Batman, No problem, it is refreshing mind when you see again. :)

+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?

+5

lets try!

+5

@sayan not completely wrong (-:

+5

@sayan so... college student LOL thanks for all your contributions

+5

lol π

+4

heres mine... its called karpekar's constant... https://code.sololearn.com/cdJpN0RtPNnW/?ref=app

+4

@sayan cool stuff! can you do it with recursion?

+3

i assume.. 7766-6677=1089...