+ 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
32 Answers
+ 17
@Batman Nice observation! How on Earth would you come up with that magic? ๐
+ 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
+ 14
Here's my try in Ruby ๐
https://code.sololearn.com/cWLNNU5IDG6u/?ref=app
+ 13
Thank you for your the challenge.
Here's my try :
https://code.sololearn.com/c7u3BWTfKE1J/?ref=app
+ 9
Really all? There may be a lot of them, there should be a limit
+ 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.
+ 8
https://code.sololearn.com/cfJJoie05A1q/?ref=app
+ 7
Okay batman
+ 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.
+ 6
+ 5
@mike it is even more crazy!
there are only 7 with permutation.
26 * 93 = 62*39
so.....
23*96 = 32 * 69
+ 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
+ 4
@::: BATMAN
herezz mine
One Liner
https://code.sololearn.com/c1q0tvHOiZhO/?ref=app
+ 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
+ 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.
+ 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
+ 3
it works fr 3 digit also...
10 * 3 = 15 * 2
102*315=210*153
+ 3
@sayan yippie!!!
can you make a prog?
+ 3
@sayan are you mathematican?