+ 17

๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ” [challenge] reversal friends ๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”๐Ÿ”

Two two-digit numbers are reversal friends, if the product does not change even if each number reverses its digits. Example : 36 * 84 = 3024 reverse the digits: 63 * 48 = 3024 Challenge: find all reversal friends except trivial solutions like 11 * 22 -> aa * bb 13 * 31 -> ab* ba have fun, all languages are welcome

14th Nov 2017, 9:00 PM
Oma Falk
Oma Falk - avatar
32 Answers
+ 17
@Batman Nice observation! How on Earth would you come up with that magic? ๐Ÿ˜‚
15th Nov 2017, 11:57 AM
Zephyr Koo
Zephyr Koo - avatar
+ 15
Here's my C# implementation! โœŒ There are 28 pairs which satisfy the requirements! I hope to make a generic solution for any number of digits with cleaner presentation but this is what I got now. Enjoy~ โค https://code.sololearn.com/cZ78EFF9j8Q3/?ref=app
15th Nov 2017, 5:19 AM
Zephyr Koo
Zephyr Koo - avatar
+ 14
Here's my try in Ruby ๐Ÿ˜Š https://code.sololearn.com/cWLNNU5IDG6u/?ref=app
15th Nov 2017, 11:05 AM
LukArToDo
LukArToDo - avatar
+ 13
Thank you for your the challenge. Here's my try : https://code.sololearn.com/c7u3BWTfKE1J/?ref=app
15th Nov 2017, 9:35 AM
LukArToDo
LukArToDo - avatar
+ 9
Really all? There may be a lot of them, there should be a limit
14th Nov 2017, 9:07 PM
David Akhihiero
David Akhihiero - avatar
+ 9
friends... very cool solutions! thanks very much! I aak myself, if there is a way not to check ALL possibilities. and indeed there is a pattern. 3*8 =24 6*4 =24 68 * 43 = 86 * 34 2*9 =18 6*3 =18 26*93 = 62*39 i am not yet done with it.
15th Nov 2017, 5:55 AM
Oma Falk
Oma Falk - avatar
15th Nov 2017, 9:03 AM
David Akhihiero
David Akhihiero - avatar
+ 8
https://code.sololearn.com/cfJJoie05A1q/?ref=app
15th Nov 2017, 12:10 PM
Kรคzรฎ Mrรฎdรนl Hรธssรครฎn
Kรคzรฎ Mrรฎdรนl Hรธssรครฎn - avatar
+ 7
Okay batman
15th Nov 2017, 8:23 AM
David Akhihiero
David Akhihiero - avatar
+ 6
@yerucham yes really all. The constraint is, that the numbers only have two digits. So there are still a lot but less than 1000.
14th Nov 2017, 9:17 PM
Oma Falk
Oma Falk - avatar
15th Nov 2017, 5:50 AM
Oma Falk
Oma Falk - avatar
+ 5
@mike it is even more crazy! there are only 7 with permutation. 26 * 93 = 62*39 so..... 23*96 = 32 * 69
15th Nov 2017, 7:05 AM
Oma Falk
Oma Falk - avatar
+ 5
I found the magic in it ... We can build the numbers just run program - it will explain the mathemagic https://code.sololearn.com/cL03mOs02v3u
15th Nov 2017, 8:21 AM
Oma Falk
Oma Falk - avatar
+ 4
@::: BATMAN herezz mine One Liner https://code.sololearn.com/c1q0tvHOiZhO/?ref=app
15th Nov 2017, 3:44 AM
sayan chandra
sayan chandra - avatar
+ 4
My Java solution to this problem. I have removed all of the simple solutions like 11 * 22 == 22 * 11 and also made sure not to print repeated values like 12 * 42 (with 21 * 24) and then later 42 * 12 (with 24 * 21) <-- spoiler alert :) Total unique pairs: 14!! https://code.sololearn.com/c9ZcYBvfU5Qg/#java
15th Nov 2017, 6:16 AM
Mike Weiss
Mike Weiss - avatar
+ 4
@Zephyr thank you! actually i cant remember what I drunk before. But suddenly I had a genius moment. I very much like patterns and I like programming for testing and finding patterns.
15th Nov 2017, 4:02 PM
Oma Falk
Oma Falk - avatar
+ 4
@sayan here is the proof: I a*b = c*d => II (10a + c)* (10b + d) = (10c+a) * (10d + b) =100ab + 10bc + 10ad + cd = 100cd + 10ad + 10bc + ab with I = 100 ab + 10ad + 10bc +cd the form is terrible but: qed
15th Nov 2017, 6:42 PM
Oma Falk
Oma Falk - avatar
+ 3
it works fr 3 digit also... 10 * 3 = 15 * 2 102*315=210*153
15th Nov 2017, 4:09 PM
sayan chandra
sayan chandra - avatar
+ 3
@sayan yippie!!! can you make a prog?
15th Nov 2017, 4:12 PM
Oma Falk
Oma Falk - avatar
+ 3
@sayan are you mathematican?
15th Nov 2017, 4:18 PM
Oma Falk
Oma Falk - avatar