Problem 35. Heshmant and 7 Dealers

-

Heshmat and 7 other real estate consultants want to count how many deals they made last year. No one wants to reveal the exact number of his deals. How can they calculate the total number of deals? Each pair of people can privately exchange any information they wish.
Link to the problem on Twitter: https://twitter.com/Riazi_Cafe/status/1701104664111124772.

-

There are various ways to solve this problem. A relatively simple way is for the first person to choose a random number \(x\) and tell the second person the sum of \(x\) and the number of his deals (in private). The second person then adds this number to the number of his deals and (privately) says that to the third person. The third person adds this number to the number of his deals and (privately) says that to the fourth person. This goes on until the last person adds the number he heard to the number of his deals and (privately) gives that back to the first person.

The first person then subtracts the value of \(x\) from the number he heard and announces that to the whole group. This way, no one is aware of anybody else’s number of deals while everybody knows the total sum of deals.