Determining Winning Combinations of Parties with >50% Votes

Ryan_m_b
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Messages
5,963
Reaction score
726
This is born out of musings around coalition governments that arise from the party with the most votes not achieving ≥50% of the votes (as opposed to emergency coalitions).

Taking the figures below how would one go about determining all the possible combinations of parties who combined have >50% of the votes without sitting down and working them out one by one?

Kid gloves please :redface: I haven't studied maths for the better part of a decade...

Parties / Percentage of votes

Pink / 21
Orange / 19
Brown / 16
Blue / 10
Green / 10
Tan / 8
Red / 5
Black / 4
Purple / 4
White / 3
 
Mathematics news on Phys.org


Brute force my friend !
Here is a groovy script that answers your question:
Code:
def X=[Pink:21, Orange:19, Brown:16, Blue:10, Green:10, Tan:8, Red:5, Black:4, Purple:4, White:3]
def XS=X.keySet() as List
def N=XS.size()
def F; F={ ix,n ->
	def L0=[XS[ix]]
	if(n==1) return [L0]
	def L=[]
	for(def j=ix; j<N-1; j++) { 
		F(j+1, n-1).each{ L<<(L0+it) }
	}
	L
}
def OK=[:]
for(def i=0;i<N;i++) {
	for(def j=1;j<=N-i;j++) {
		def c=F(i,j)
		c.each{ 
			def s=0; it.each { s+=X[it]} 
			if(s>50) OK[it]=s 
		}
	}
}
OK.keySet().sort{x,y->OK[y]<=>OK[x]}.each{ println "$it: ${OK[it]}%" }
I don't post the result since there are 502 winning combinations going all the way from 51% up to 100% :smile:
 


oli4 said:
Brute force my friend !
Here is a groovy script that answers your question:
I don't post the result since there are 502 winning combinations going all the way from 51% up to 100% :smile:
Wow thanks a lot! To be honest I'm not really sure how to work code lol but it's good to know that there's a relatively simple way to get it done. Thanks!
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.

Similar threads

Back
Top