I have
list1={10, 3, 25, 6, 28, 21, 17, 22, 1, 24, 16, 7, 9, 15, 2, 18, 5, 27, 30, 8}
list2={17, 11, 24, 22, 20, 27, 1, 21, 25, 30, 2, 18, 9, 29, 10, 23, 8, 26, 15, 28}
I want to create a list of multiply a member of list1 to a member of list2 in the order: 10*28, 3*15, 25*26, 6*8 ....
for example with Do[list1[[i]].list2[[21 - i]], {i, 1, 20}]]]
After that I want to sort the last result from smaller to larger. and determine the first of the final list
The psudo-code:
First[Sort[Do[list1[[i]].list2[[21 - i]], {i, 1, 20}],, #1 < #2 &]]
I can write it with define another (third) list for Do[list1[[i]].list2[[21 - i]]
, But how can I write this code without defining third list. and how can I recognize the first element of the sorted final list (which is determined with First
, is relate to which i
(which element of the list1)
First@Sort[list1*Reverse@list2]
. $\endgroup$