TransWikia.com

Find sum of positive geometric progression numbers

Mathematica Asked by emmaakachukwu on July 24, 2021

I have a task to get the total number of games played in a soccer tournament. Apart from the group stages, I observed that the number of games played in each round from the knockout round down to the final round is n/2 games where n = number of teams. An easy way of getting the number of games from the knockout stage to the final according to my observation would be by summing up the geometric sequence positive integers like n/2 + (n/2)/2 + .... How can I achieve this please ?

3 Answers

Clear["Global`*"]

In the tournament, {CumulativeGamesPlayed, TeamsAdvancing} evolves as

FixedPointList[{#[[1]] + Floor[#[[2]]/2], Ceiling[#[[2]]/2]} &, {0, 7}]

(* {{0, 7}, {3, 4}, {5, 2}, {6, 1}, {6, 1}} *)

Then the sequence of {n, CumulativeGamesPlayed} is given by

seq = Table[{n, 
   FixedPoint[{#[[1]] + Floor[#[[2]]/2], Ceiling[#[[2]]/2]} &, {0, 
      n}][[1]]}, {n, 2, 15}]

(* {{2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 5}, {7, 6}, {8, 7}, {9, 8}, {10, 9}, {11,
   10}, {12, 11}, {13, 12}, {14, 13}, {15, 14}} *)

Generalizing from the sequence,

games[n_Integer?Positive] = FindSequenceFunction[seq, n]

(* -1 + n *)

There are one fewer games played than the number of teams

For n == 7

TreePlot[{1 -> 8, 2 -> 8, 3 -> 9, 4 -> 9, 5 -> 10, 6 -> 10, 7 -> 11, 8 -> 12, 
  9 -> 12, 10 -> 13, 11 -> 13, 12 -> 14, 13 -> 14}, Bottom, 
 VertexLabels -> Automatic]

enter image description here

For n == 8

TreePlot[{1 -> 9, 2 -> 9, 3 -> 10, 4 -> 10, 5 -> 11, 6 -> 11, 7 -> 12, 
  8 -> 12, 9 -> 13, 10 -> 13, 11 -> 14, 12 -> 14, 13 -> 15, 14 -> 15}, Bottom,
  VertexLabels -> Automatic]

enter image description here

Answered by Bob Hanlon on July 24, 2021

Here's one way

numGames[n_] := Block[{rounds},
  rounds = Log[2, n];
  If[!IntegerQ@rounds, Print["bad bracket"]; Abort[];,
   Sum[n/2^i, {i, rounds}]]]

We assume the number of teams is a power of $2$ so you can keep dividing by $2$ each round. If it's not, we quit. Otherwise we do your sum, $$n/2+n/2/2+n/2/2/2+dots=n/2+n/2^2+n/2^3+dots=sum_i n/2^i$$

So if we run numGames[64] we get $63$ back. As @BobHanlon mentions, we get $n-1$ games for $n$ players. We can see this directly with

Sum[n/2^i, {i, Log[2, n]}]

which gives $n-1$

Answered by bRost03 on July 24, 2021

  • In a final two teams play and one wins. Let us call this play a stage zero because it is very important.

  • In semifinals four teams play and two win. Let us call this stage one.

  • In quarterfinals eight teams play and four win. Let us call this stage two.

  • In one-eights of a final sixteen teem play and eight win. Call this stage three.

There are not many soccer tournaments with more stages. Thus, highest stage is $s=3$. Now we can make a table:

Stage(s) Teams(n) Wins(w) Games(g) Name 
0        2        1       1        Final
1        4        2       2        Semifinals
2        8        4       4        Quarterfinals
3       16        8       8        One-eights of a final

Now everything is easy:

  • Each game has a winner in a single-elimination tournament. Therefore the number of winners is equal to the number of games $w = g$.
  • Number of winners at the stage $s$ is equal to $w=g=2^s; (sge0)$. This can be appreciated from the table, or one can use mathematical induction to prove this equation.
  • Now we can use the power of Mathematica to compute the total number of games in a tournament starting from stage $s$:

gtotal = Sum[2^i, {i, 0, s}]
(* -1 + 2^(1 + s) *)

Finally, the total number of teams $n$ is equal twice the number of winners, i.e., $n=2 w$. This product too can be computed with Mathematica

n = 2 2^s
(* 2^(1 + s)*)

By making use of the two last calculations we arrive at the conclusion that

$$g_text{total} = n - 1, quad n>0.$$

This is the answer suggested by @JimB in the comment. However, it was not appreciated that it is only valid for $n>0$. For zero number of teams ($n=0$) there are $g_text{total}=0$ games. However, there could be a game for the third place. In this case we add one to the result above and obtain $$g_text{total with small final} = 1 + g_text{total} = n,quad n>0.$$

Answered by yarchik on July 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP