I am terrible with algorithms but here goes
Suppose one wants to find, for a given list of distinct numbers, the sum of the products of every pair of different numbers in the list. For example, if the list consists of 4, 10, 20, 100 then we would compute 4*10 + 4*20 + 4*100 + 10*100 + 20*100 = 3720
The task is to write out an algorithm for the above calculation for an arbitrary list of n distinct numbers.
I am lost and don't know where to begin
Suppose there were n numbers in the list. Then if you simply multiply all the pairs together, which seems to be what aman_cc is suggesting you have to do n*(n-1)/2 multiplications. So for 10 numbers that would be 45 multiplications. But you can do it with only 11 multiplications and one division like this:
Add all the numbers together, and square the result
Add the squares of all the numbers together.
Subtract the second number from the first and divide by 2.
I think you should try to do a little more work yourself now. In any case I don't know what system you are supposed to be using for writing down your algorithm. I've used a form of the binomial theorem here, or whatever its equivalent for more than two terms is called.
Why not try to use the same kind of language aman_cc used, but to describe my algorithm instead.