[Question]
  [
*Not to be confused with [Least Common Multiple](https://codegolf.stackexchange.com/questions/94999/least-common-multiple).*
Given a list of positive integers with more than one element, return the most common product of two elements in the array.
For example, the MCM of the list `[2,3,4,5,6]` is `12`, as a table of products is:
```
    2  3  4  5  6
  ---------------
2 | #  6  8  10 12
3 | #  #  12 15 18
4 | #  #  #  20 24
5 | #  #  #  #  30
6 | #  #  #  #  #
```
*Thanks DJMcMayhem for the table*
As `12` appears the most times (two times as `2*6` and `3*4`). Note that we aren't including the product of an element and itself, so `2*2` or `4*4` do not not appear in this list. However, identical elements will still be multiplied, so the table for `[2,3,3]` looks like:
```
    2  3  3
  ----------
2 | #  6  6 
3 | #  #  9
3 | #  #  #
```
With the MCM being `6`.
In the event of a tie, you may return any of the tied elements, or a list of all of them.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest byte count for each language wins!
### Test-cases:
```
[2,3,4,5,6] -> 12
[7,2] -> 14
[2,3,3] -> 6
[3,3,3] -> 9
[1,1,1,1,2,2] -> 2
[6,200,10,120] -> 1200
[2,3,4,5,6,7,8,8] -> 24
[5,2,9,10,3,4,4,4,7] -> 20
[9,7,10,9,7,8,5,10,1] -> 63, 70, 90 or [63,70,90]
```
  
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 11 bytes
```
{⊇Ċ×}ᶠọtᵒth
```
[Try it online!](https://tio.run/##ATAAz/9icmFjaHlsb2cy//974oqHxIrDl33htqDhu4104bWSdGj//1syLDMsNCw1LDZd/1o "Brachylog – Try It Online")
### Explanation
```
{   }ᶠ          Find all:
 ⊇Ċ×              Product of a subset of 2 elements
      ọtᵒ       Order by occurrences
         th     Take the last element and discard the number of occurrences
```
[Answer]
# [R](https://www.r-project.org/), ~~54~~ ~~50~~ 41 bytes
```
order(-tabulate(combn(scan(),2,prod)))[1]
```
[Try it online!](https://tio.run/##K/r/P78oJbVIQ7ckMak0J7EkVSM5PzcpT6M4OTFPQ1PHSKegKD9FU1Mz2jD2v5GCsYKJgqmCmYK5goWCxX8A "R – Try It Online")
Alternatively, for ~~54~~ ~~53~~ 44 bytes:
```
names(sort(-table(combn(scan(),2,prod))))[1]
```
[Try it online!](https://tio.run/##K/r/Py8xN7VYozi/qERDtyQxKSdVIzk/NylPozg5MU9DU8dIp6AoP0UTCKINY/8bKRgrmCiYKpgpmCtYKFj8BwA "R – Try It Online")
In principle, the latter version outputs the relevant result even without the `names` function, but followed by the count of such most frequent products, which isn't asked for...
Thanks to CriminallyVulgar for -4 and -1, and Giuseppe for -9 on both.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
ŒcP€Æṃ
```
[Try it online!](https://tio.run/##y0rNyan8///opOSAR01rDrc93Nn8////aCMdYx0THVMds1gA "Jelly – Try It Online") or [Check out the test suite](https://tio.run/##y0rNyan8///opOSAR01rDrc93Nn8/3A7kOn@/3@0kY6xjomOqY5ZrI5CtLmOEYgCiRmDGIY6EGgEETfTMTIw0DEEIiMDmDqwXh1zHQsdC5CQKVCtJUgJSAYEzUGilkAFQDFLsDpTsAmxAA).
### How it works
```
ŒcP€Æṃ – Full program / Monadic link.
Œc     – Unordered pairs without replacement.
  P€   – Product of each.
    Æṃ – Mode (most common element).
Alternative: ŒcZPÆṃ
```
[Answer]
# Pyth, 12 bytes
```
eo/QN=*M.cQ2
```
[Test suite](https://pyth.herokuapp.com/?code=eo%2FQN%3D%2aM.cQ2&input=%5B2%2C3%2C4%2C5%2C6%5D&test_suite=1&test_suite_input=%5B7%2C2%5D%0A%5B1%2C1%2C1%2C1%2C2%2C2%5D%0A%5B6%2C200%2C10%2C120%5D%0A%5B2%2C3%2C4%2C5%2C6%2C7%2C8%2C8%5D%0A%5B5%2C2%2C9%2C10%2C3%2C4%2C4%2C4%2C7%5D%0A%5B9%2C7%2C10%2C9%2C7%2C8%2C5%2C10%2C1%5D&debug=0)
First, we take all 2 element combinations of the input without replacement (`.cQ2`). Then, we map each of these pairs to their product (`*M`). Next, we overwrite the input variable with the list of products (`=`). Next, we sort the list of products by the number of occurrences in the list of products (`o/QN`). Finally, the take the final element of the sorted list (`e`).
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~8~~ 7 bytes
```
2XN!pXM
```
[Try it online!](https://tio.run/##LYu9CoAwDIR338L9hja1f7urTg6FUtBdwcH3j2mUCzm4@@46npN3prKOd1l43rgSHCZ4hDbUCJLfEyfufrf4RNoGkDGwcmR@WOeISEiSeAFzB3rRFSXMUkuUlfI6by8 "MATL – Try It Online")
*(-1 byte by using the method from @Mr. Xcoder's [Jelly answer](https://codegolf.stackexchange.com/a/170052/8774).)*
```
2XN     % nchoosek - get all combinations of 2 elements from input
!p      % get the product of each combination
XM      % 'mode': get the most common value from that
```
---
Older answer:
### 8 bytes
```
&*XRXzXM
```
[Try it online!](https://tio.run/##LYu9CoAwEIN3H8RBMrRX@7e7uohDoRR0183Jlz@vteS4QPLlPp@LDx6ntKU3rbzsnAkGMyxcGbIHya@JETfdNX5Rax1IKWg5Uh1uc3gEBEmsgLECtajyEkapJYqNsm1ePg "MATL – Try It Online")
```
&*    % multiply input by its transpose,
      %  getting all elementwise products
XR    % take the upper-triangular portion of that,
      %  zeroing out repetitions and mainly self-multiplications
Xz    % remove the zeroed out parts
XM    % 'mode' calculation - get the most common value from that
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~8~~ 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
æ2ùP.M
```
-2 bytes thanks to *@Kaldo*.
[Try it online](https://tio.run/##MzBNTDJM/f//8DKjwzsD9Hz//4820jHWMdEx1TGLBQA) or [verify all test cases](https://tio.run/##MzBNTDJM/W/p5ulir6TwqG2SgpK9y//Dy4wO7wzQ8/2v8z/aSMdYx0THVMcslivaXMcISIJEjIG0oQ4EGoFFzXSMDAx0DIHIyACqCKxNx1zHQscCKGIKVGgJUgCSAEFzoKAlUBooZAlWZQrWDhQ1BtsAAA).
**Explanation:**
```
æ         # Take the powerset of the input-list
          #  i.e. [2,3,3] → [[],[2],[3],[3],[2,3],[2,3],[3,3],[2,3,3]]
 2ù       # Leave only the inner lists of size 2:
          #  i.e. [[],[2],[3],[3],[2,3],[2,3],[3,3],[2,3,3]] → [[2,3],[2,3],[3,3]]
   P      # Take the product of each remaining pair
          #  i.e. [[2,3],[2,3],[3,3]] → [6,6,9]
    .M    # Only leave the most frequent value(s) in the list
          #  i.e. [6,6,9] → [6]
```
[Answer]
# Mathematica, 32 bytes
*-17 bytes (and a fix) thanks to [JungHwan Min](https://codegolf.stackexchange.com/users/60043).*
```
Commonest[1##&@@@#~Subsets~{2}]&
```
Pure function. Takes a list of numbers as input and returns the list of MCMs as output.
[Answer]
# MATLAB, 43 bytes
```
I=input('');i=I'*I*1-eye(nnz(I));mode(i(:))
```
It's also kind of a tongue twister!
**Explanation**
```
I=input('');           % Takes an input like "[2,3,4,5,6]"
i=I'*I                 % Multiplies the input by its own transverse
      *1-eye(nnz(I));  % Multiplies by 1-identity matrix to remove diagonal
mode(i(:))             % Calculates most common value and prints it
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~41~~ 38 bytes
```
{key max bag(@_ X*@_)∖@_»²: *{*}:}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwvzo7tVIhN7FCISkxXcMhXiFCyyFe81HHNIf4Q7sPbbJS0KrWqrWq/V@cWKmQplGjEq@pkJZfxBVtpGOsY6JjqmMWq8MVba5jBKJAYsYghqEOBBpBxM10jAwMdAyByMgApg6sV8dcx0LHAiRkClRrCVICkgFBc5CoJVABUMwSrM4UbEKs9X8A "Perl 6 – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), ~~12~~ 10 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
╢êv^⌐ö►♣Ä»
```
[Run and debug it](https://staxlang.xyz/#p=b688765ea99410058eaf&i=[2,3,4,5,6]%0A[7,+2]%0A[2,3,3]%0A[1,1,1,1,2,2]%0A[6,200,10,120]%0A[2,3,4,5,6,7,8,8]%0A[5,2,9,10,3,4,4,4,7]%0A[9,7,10,9,7,8,5,10,1]&a=1&m=2)
[Answer]
# [Python 3](https://docs.python.org/3/), ~~77~~ 72 bytes
```
f=lambda k,*l,m=[]:l and f(*l,m=m+[k*x for x in l])or max(m,key=m.count)
```
[Try it online!](https://tio.run/##LYzbDoMgDEDf/Yo@omsWxXlN/BJCFjZ1MwIao4t@vStslLTl9JT5WN@TTc@zb7Qyj1bBiJFG0whZa1C2hZ75t7mIMdqhnxbYYbCgZUitUTszOHZHY67PabNreDrj7oxF2VfHyrAOAOZlsCujr7qP0myw87aykM4pOKZ4wwxzGYgCOWVHUqoJ/oJ7miOPY0zo8vgv@TUssMSSSEZi5QQ3cFEQrGhMqPJW5tflFw "Python 3 – Try It Online")
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 59 bytes
```
Last##~SortBy#`&&:`~##{Flat[UpperTriangle&1!Table&_!`*]^^0}
```
[Try it online!](https://tio.run/##VU1NC4JAEL37KyY2PMQcTDNT6FLQKSLITsuWm60WRIm7l4j667a1buTwhvl6bx5Xiucn0RSQTJsll4qQ1@ZWq9mdZK6bZC9CHosLV3RbVaJO6zO/lhfhDnspP@i672UDttt5z2YlxFHSflXlJXPW9fmqUiHVnEshaYFAHdBBfYQAYYQQIowZmmWE4NveEAI7Bt1xiPCD/6ca697z9PqTvtd91rohaJ@Jhr2G3x@xURmeQWQZ8VfzOcdWHbYmzGGseQM "Attache – Try It Online")
Still working on golfing this down a bit, but I think this is near optimal for the approach I've chosen.
## Explanation
This is a composition of three functions:
1. `{Flat[UpperTriangle&1!Table&_!`*]^^0}`
2. `SortBy#`&&:`~`
3. `Last`
The first function does the bulk of the computation:
```
{Flat[UpperTriangle&1!Table&_!`*]^^0}
{                                   }    anonymous lambda; input: _ (e.g.: [2,3,4,5,6])
                      Table&_!`*         shorthand for Table[`*, _]
                                         this creates a multiplication table using the input
                                         e.g.:
                                           4  6  8 10 12
                                           6  9 12 15 18
                                           8 12 16 20 24
                                          10 15 20 25 30
                                          12 18 24 30 36
      UpperTriangle&1!                   takes the strict upper triangle of this matrix
                                         e.g.:
                                          0 6  8 10 12
                                          0 0 12 15 18
                                          0 0  0 20 24
                                          0 0  0  0 30
                                          0 0  0  0  0
Flat[                           ]^^0     flattens this list and removes all 0s
                                         e.g.: [6, 8, 10, 12, 12, 15, 18, 20, 24, 30]
```
The second is a bit complicated but does something rather simple. First, it is useful to know that `f&n` is a function which, when called with arguments `...x`, returns `f[...x, n]`. `f&:n` is similar, returning `f[n, ...x]`. Now, let's decompose this:
```
( ~SortBy ) # (`& &: `~)
```
First, `f#g` creates a fork. With input `n`, it returns `f[n, g[n]]`. However, in this case, `f` is the function `~SortBy`. `~f` reverses the arguments of the function. This means that `~f#g` is equivalent to `f[g[n], n]`, or here, `SortBy[(`& &: `~)[n], n]`.
``& &: `~` follows the form `f&:n`. But what are ``&` and ``~`? They are "operator quotes", and return a function equivalent to the quoted operator. So, in this case, ``&` is the same thing as `${ x & y }`. With that in mind, this expression is equivalent to the following for binary operators:
```
f&:n   <=>   ${ f[n, x] }
       <=>   ${ (`&)[`~, x] }
       <=>   ${ `~ & x }
```
This yields the function ``~&x`, where `x` is the result from the first function. `n ~ a` counts the occurrences of `n` in `a`. So, this returns a function which counts the occurrences of the argument in the computed array from function 1.
Going back to `SortBy`, this each element in the array by the number of times it appears in it.
Finally, `Last` takes the element which occurs the most. Ties are broken by the sorting algorithm.
[Answer]
# JavaScript (ES6), ~~72~~ 70 bytes
```
a=>a.map(m=o=(y,Y)=>a.map(x=>Y--<0?m=(o[x*=y]=-~o[x])<m?m:o[r=x]:0))|r
```
[Try it online!](https://tio.run/##dY/BbsIwDIbvfYocE@SCm9KWIAzPgSofIgbTJkJQmaYiTbx6l8JApWVxDnH05cvvT/ttT5vq4/gVH/zbttlRY2lpx84epSNP8gxrdb@oabmO4wWuHElf1iM6M8WXcGK1cCs392VFNc9RqZ@q2fjDye@3471/lztZakhhChnkLB5LKTGZiERHPbYA3aGe2Gn0wpvyKzbvowncSnf0N3SQIAeNCEnYGrmXFjH6bzYoYAYz7ogHebPwvWnN7ZO2Cr6zA68JvkCaqza7xuG/2VIQBYIwKHwlytCGziA3vw "JavaScript (Node.js) – Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~29 27~~ 19 bytes
```
{⌈/⊢/⊣¨⌸∊⍵}⍳∘≢↓¨⊢×⊂
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v/pRT4f@o65FQLz40IpHPTsedXQ96t1a@6h386OOGY86Fz1qmwwU71p0ePqjrqb/aY/aJjzq7XvUN9XT/1FX86H1xo/aJgJ5wUHOQDLEwzP4/6PeVWmHVmhYKpgrGBoogCgLBVMQ01BTQcNIwVjBBMg1A7LNFYygIsZA2hhKGypAoBFY1kzByMAArNnIAFk72FQLoIgpUKElSAFIAgTNNQE "APL (Dyalog Unicode) – Try It Online")
Tacit fn.
Thanks to Adám for the tacit version and 2 bytes.
Thanks to ngn for 8 bytes!
### How:
```
{⌈/⊢/⊣¨⌸∊⍵}⍳∘≢↓¨⊢×⊂
                ⊢×⊂   ⍝ Multiply each element with the entire argument, then
           ⍳∘≢↓¨      ⍝ Remove 1 from the first, two from the next etc. (removes repeated multiplications);
                      ⍝ The result is then fed into the function:
{       ∊⍵}           ⍝ Flatten the result;
     ⊣¨⌸              ⍝ Key; creates a matrix in which each row corresponds to a unique product;
   ⊢/                 ⍝ Get the rightmost column of the matrix;
 ⌈/                   ⍝ Get the highest value.
```
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 5 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md "Thunno 2 Codepage")
```
2ċ€pṀ
```
#### Explanation
```
2ċ€pṀ  # Implicit input
2ċ     # Combinations of length 2 of the input
  €p   # Product of each pair in this list
    Ṁ  # Mode of this list
       # Implicit output
```
#### Screenshot
[![Screenshot](https://i.stack.imgur.com/tb9wYm.png)](https://i.stack.imgur.com/tb9wY.png)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 24 bytes
```
ＷθＦ×⊟θθ⊞υκＩ⊟Φυ⁼№υι⌈Ｅυ№υλ
```
[Try it online!](https://tio.run/##PYs9C8IwEIZ3f0XGC5xgB1HpWHQrZHArHY4SSTAxzZf672Oi4Lvc3fPcuygKiyNTyktpIxl4zm4uMLhqKyMIt1aCzHPORI4KMrI77zci6EeCgWL6vly0STI0efaZTITB5errrWt5pLe22cJIa0N/Z/gvfSnTdMIDdjts44j7tnbzXLZP8wE "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｗθ
```
While the input array is non-empty...
```
×⊟θθ
```
... pop the last element and multiply the rest of the array by that element...
```
Ｆ...⊞υκ
```
... and push the results to the predefined empty list.
```
⌈Ｅυ№υλ
```
Count the number of times each product appears in the list and take the maximum...
```
Φυ⁼№υι...
```
... then filter for the products whose count equals that maximum...
```
Ｉ⊟
```
...then pop the last element and cast to string for implicit print.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
Ṡ►#mΠṖ2
```
[Try it online!](https://tio.run/##yygtzv6fG5yvnaCtpKBrp6CkUfyoqbFI89C2/w93Lng0bZdy7rkFD3dOM/r//3@0kY6xjomOqY5ZLFe0uY4RkASJGANpYyhtqAOBRmBZMx0jAwMdQyAyMoAqBmvXMdex0LEAipgCFVqCFIAkQNAcKGgJlAYKWYJVmYK1xwIA "Husk – Try It Online")
## Explanation
```
Ṡ►#mΠṖ2  -- example input [3,3,3]
     Ṗ2  -- subsequences of length 2: [[3,3],[3,3],[3,3]]
   mΠ    -- map product: [9,9,9]
Ṡ        -- apply 
  #      -- | count occurences in list
 ►       -- to maxOn that list: [9]
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~20~~ 16 bytes
* -4 bytes from @Shaggy
---
```
£s°Y m*XÃc
ñ@è¥X
```
[Try it online!](https://tio.run/##y0osKPn//9Di4kMbIhVytSIONydzHd7ocHjFoaUR//9HW@qY6xga6IAoCx1TENMwVkE3AwA "Japt – Try It Online")
[Answer]
# [CJam](https://sourceforge.net/projects/cjam/), ~~70~~ 68 bytes
```
q',/S*~_,(:L{LX-,0a\+[{X1++}*](;{_X=\_Y=@*\}fY}fX]~;]_{\_@e=}$\;_,(=
```
[Try it online!](http://cjam.aditsu.net/#code=q%27%2C%2FS*~_%2C1-%3AL%7BLX-%2C0a%5C%2B%5B%7BX1%2B%2B%7D*%5D(%3B%7B_X%3D%5C_Y%3D%40*%5C%7DfY%7DfX%5D~%3B%5D_%7B%5C_%40e%3D%7D%24%5C%3B_%2C1-%3D&input=%5B1%2C2%2C3%2C4%5D)
## Explanation
```
q',/S*~                                                                  Turn input string into a valid CJam array
       _,(                                                               Find the length of the array and subtract 1
          :L                                                             Assign the result to L
            {                                 }fX                        Outer for loop
             LX-,0a\+[{X1++}*](;                                         Create an array with all the array indexes bigger than X
                                {          }fY                           Inner for loop
                                 _X=\_Y=@*\                              Create a multiple of array[X] and array[Y] (Guaranteed to be from a unique combination of factors)
                                                 ~;]                     Casts away all stack items except for an array of the multiples
                                                    _{\_@e=}$\;          Sorts array by number of occurrences (largest number of occurences at the end)
                                                               _,(=      Gets the last element of the array
```
You will need to scroll right to see the explanations as the code is quite long, as well as the explanations.
---
This was an absolute nightmare to write. CJam doesn't have a powerset function (unlike a ton of other golfing languages - great choice on my part), which means that I had to manually find the powerset. However, this gave me the opportunity to ignore any invalid number of factors, unlike other answers with a powerset function.
This should be golfable, considering I'm terrible at CJam.
---
### Changes:
[Helen](https://codegolf.stackexchange.com/users/58707/helen) cut off 2 bytes!
Old: `q',/S*~_,1-:L{LX-,0a\+[{X1++}*](;{_X=\_Y=@*\}fY}fX]~;]_{\_@e=}$\;_,1-=`  
New: `q',/S*~_,(:L{LX-,0a\+[{X1++}*](;{_X=\_Y=@*\}fY}fX]~;]_{\_@e=}$\;_,(=`
By changing the `1-`s to simply `(` we get the same effect but with a lower byte count.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~7~~ 6 bytes
*-1 byte thanks to The Thonnu*
```
2ḋvΠ∆M
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiMuG4i3bOoOKIhk0iLCIiLCJbMiwzLDQsNSw2XVxuWzcsMl1cblsyLDMsM11cblszLDMsM11cblsxLDEsMSwxLDIsMl1cbls2LDIwMCwxMCwxMjBdXG5bMiwzLDQsNSw2LDcsOCw4XVxuWzUsMiw5LDEwLDMsNCw0LDQsN11cbls5LDcsMTAsOSw3LDgsNSwxMCwxXSJd)
[Answer]
# [Java (JDK 10)](http://jdk.java.net/), 132 bytes
```
a->{int l=a.length,i=l,j=0,r=99999,m[]=new int[r];for(;i-->0;)for(j=l;--j>i;)m[a[i]*a[j]]++;for(;r-->0;)i=m[r]<i?i:m[j=r];return j;}
```
[Try it online!](https://tio.run/##ZVFdb4IwFH33V9yYmMi8EMT5iXXxZcke9uTeCA@dgmsHhbTFxRh@u2vBjZlRSHvuuef2Hi6nJ@ryw@eV5WUhNXCDvUqzzHsIe/9iaSX2mhXCkmX1nrE97DOqFLxSJuDSA7hFlababKeCHSA33HCnJRPHKAYqj8ppUgHeihehn28110zoKN5ACuRK3c3FQMgI9bJEHPUHMpIhJz5KsrQP5lFMRPIFViXjMC3kMGSuu/FDx545yULX5RsWOnlEIxY/0IjH8WjUZso2k5HciNfsia3yiBNTRya6kgJ4WF/DpsemK9O3TpRWQG6dA1wCnOAjTnFW409ojkEHLD/p4OQejrFdwV/JDAPfx7F5A/@@UHMRznGBi46YGvXSplvernnHLU2yYZaNZtrUvJF168v@hsZb42zV@nN@7e3OSie5V1TaK83kdDrsD9QKBoeB6CNspaRn5emiHevQih2E1KNlmZ23yoy1jTntZXXPfvX1Gw "Java (JDK 10) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), ~~96~~ 94 bytes
-2 bytes thanks to [nimi](https://codegolf.stackexchange.com/users/34531/nimi) (using `sortOn(0<$)` instead of `length`)!
```
import Data.List
f a|b<-zip[0..]a=last.last.sortOn(0<$).group$sort[x*y|(i,x)<-b,(j,y)<-b,i/=j]
```
[Try it online!](https://tio.run/##TU/LboMwELzzFauIg2kWl0AJoYJe2mOqHnqkqHJUkjjlYWFHJVX@ndoOjeK1VuOZ2ZF3z@R3VdfjyBvR9QpemGJ0zaVytsDOm8z/5aIIKC1ZXjOpqG1SO99aEmSuR3d9dxSuYYrh7nQmHAcv8zdIDniygN/nh3KsBtaIupKQOwAFFCFG@IAxLkv9RigSDCdklGjC0Q1e4KXCq3OJYRDgQt8wuBm2sZjgClcTG@uh1BiNaCqZhFTbNJ1ad2yjjFI6TsN4Czk0TLx@AvkYpP8E4qjeVb9uwQW5735gkDCfwwy0NDPIkmSrec/TKfpQII//m1@pvmJfF5xnGewq9dy1qmqVHPWO5gd/ "Haskell – Try It Online")
[Answer]
## MATLAB 39 bytes
```
a=input('');
b=triu(a'*a,1);
mode(b(b~=0))
```
Also check out [answer by Jacob Watson](https://codegolf.stackexchange.com/a/170084/80759)
[Answer]
# SQL Server, 93 bytes
```
SELECT TOP 1a.a*b.a
FROM @ a
JOIN @ b ON a.i<b.i
GROUP BY a.a*b.a
ORDER BY COUNT(a.a*b.a)DESC
```
Input is assumed to come from a table of the form
```
DECLARE @ TABLE (A int, i int identity);
```
Example table population:
```
INSERT INTO @ VALUES (9), (7), (10), (9), (7), (8), (5), (10), (1);
```
Explanation:
I assume a "list of integers" will have an index associated with them, which in my case is the column `i`. The column `a` contains the values of the list.
I create products of every pair, where the left pair comes in the list earlier than the right pair. I then group on the product, and sort by the most populous number.
I'm a little sad I didn't get to use any cte or partitioning clauses, but they were just too long. `SELECT` is a very expensive keyword.
# Alternative, 183 bytes
```
WITH c
AS(SELECT a,ROW_NUMBER()OVER(ORDER BY a)r
FROM @),d AS(SELECT a.a*b.a p,COUNT(a.a*b.a)m
FROM c a
JOIN c b ON a.r<b.r GROUP BY a.a*b.a)SELECT TOP 1p
FROM d
ORDER BY m DESC
```
If SQL doesn't get to have a separate index column, here is a solution where I create an index using the `ROW_NUMBER` function. I personally don't care about the order, but an order is required and using the `a` column is the shortest.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 29 bytes
```
q~:L,2m*{:-},{Lf=:*}%$e`:e>1=
```
[Try it online!](https://tio.run/##S85KzP3/v7DOykfHKFer2kq3VqfaJ83WSqtWVSU1wSrVztD2//9oYwUgjAUA "CJam – Try It Online")
[Answer]
## Burlesque - 8 bytes
```
Jcp)pdn!
J        duplicate
 cp      cross product
   )pd   map . product
      n! most common element
```
[Try it online here.](http://cheap.int-e.eu/~burlesque/burlesque.cgi?q=%7B2%203%204%205%206%7DJcp%29pdn%21)
(and yes, Burlesque also has a command for "least common element")
[Answer]
# J, ~~29~~ ~~25~~ ~~24~~ 23 bytes
```
(0{~.\:1#.=)@(</#&,*/)~
```
[Try it online!](https://tio.run/##VY3LCsIwEEX3/YqLBdtITSdpkzTFgiC4cuXanbSIGz9A6K/HvBRkCCT33DN5ug2vFkwjKjQgjP7sOU7Xy9nV9F75bRQln9ixPrTlttm1bHWsmO@PF4TEhAUSHXoo6Jz2MTWQ6a1/pQ4pSZrII79FIYki0Qg3QSHJRv//k98@YMgsScpTG6RQCWMSrhcfmwBstFRczDBz6A4wBFgq3Ac "J – Try It Online")
## how
```
(~. {.@\: 1 #. =)@(</ #&, */)~
                  (</ #&, */)~  NB. all products, dups removed:
                          */    NB. create the times table
                   </           NB. lower triangular ones matrix
                       &,       NB. flatten each and
                      #         NB. filter based on lower triangle
                 @              NB. pass that result to
(~. {.@\: 1 #. =)               NB. get the most frequent list item:
       \:                       NB. sort down
 ~.                             NB. the uniq elements
          1 #. =                NB. by their count
    {.@                         NB. and take the first element
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 95 bytes
```
x=>x.SelectMany(y=>(x=x.Skip(1)).Select(z=>y*z)).GroupBy(y=>y).OrderBy(y=>y.Count()).Last().Key
```
[Try it online!](https://tio.run/##dU5NC4JAEL33KzzuxiStVha5eygqoqKgY3QwW0GyVVYl1@i321qewhiYN@/Nmw8/7flpWC1z4bvrhcjvXHqXiLuhyBjUyQgMWhWUFeaRR9zPdp5QSFGGCqqlW5gggnHTQyVlqltqvpJxnsw@RoXNvbxy2TBzHuciQ9qz9VKN5oarato5SH0MBUjwx@n8tMCGAQxh9ML4t@eA1aLWE3aLbv/RCXzDat02AQdIH2oY6zd0SWpX9QY "C# (Visual C# Interactive Compiler) – Try It Online")
Less golfed code:
```
// x is a list of integers
x=>
  // iterate over each integer and
  // return a list per element.
  // flatten the list of lists to 1 list
  x.SelectMany(y=>
    // skip the current value and save
    // newly offset list to x so that it
    // can be incrementally offset
    // again next pass
    (x=x.Skip(1))
      // compute the product
      .Select(z=>y*z))
    // get the unique products
    .GroupBy(y=>y)
    // sort the products by number
    // of occurrences
    .OrderBy(y=>y.Count())
    // pick the product with the
    // greatest number of occurrences
    .Last().Key
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 6 bytes
```
►=mΠṖ2
```
[Try it online!](https://tio.run/##yygtzv6fG5yvnaCtpKBrp6CkUfyoqbFI89C2/4@m7bLNPbfg4c5pRv///4820jHWMdEx1TGL5Yo21zECkiARYyBtDKUNdSDQCCxrpmNkYKBjCERGBlDFYO065joWOhZAEVOgQkuQApAECJoDBS2B0kAhS7AqU7D2WAA "Husk – Try It Online")
`►=` gives -1 over the other answer.
`×*` has too many duplicates and doesn't give the right value.
[Answer]
# [Julia 1.0](http://julialang.org/), ~~99~~ 83 bytes
```
~=length
!x=argmax(sum.(.==(1:max((M=[x[i]x[j] for i=1:~x for j=i+1:~x])...)),[M]))
```
[Try it online!](https://tio.run/##TY/PboMwDMbP4ylMtUOiWYg/BQpSpk3atU8Q5YAGawMprQjVsktfnSUBTZNz8M/299np70o2iVmWB1PdeJrPQWhYM50ujSH6folIxBhJaofkyLjhUhjeC/i6TiBZUj@MT3smXxwIGkURpciPgtKlZR/ycybBE08xwz3mWAhgr5CkaGslpivtcZvIPBcOsz@sHCa4RrppvEGBaRxjYl8ab76W/2/DEg94WBV@S24dKidxAy7KtWllNAhujdZdCwwapQhv@WCbDMLBf3EAOcLQ/WjSUkGD2yTHWY1k964UzJ2eNazyGp7XZGcd3/T5@g0hr@wldmvlD8r9zWL5BQ "Julia 1.0 – Try It Online")
-16 bytes (!!) thanks to MarcMush:
* Remove `*` (use implicit multiplication)
* Replace `map` with a broadcast
* Replace `findmax` with `argmax`
* Use the return value of a variable assignment
* Use `sum` instead of `count`
]