JSFiddle - React, Tailwind, and code Playground
JavaScript
const getPercantageValue = (votersCount, currentVoter) => (100/votersCount * currentVoter)
for (i = 1; i < 20; i++) {
for (j = 1; j < 20; j++) {
const a = getPercantageValue(i+j, i)
const b = getPercantageValue(i+j, j)
const aRounded = Math.round(a)
const bRounded = Math.round(b)
const abRoundedSum = aRounded + bRounded
if (abRoundedSum !== 100) {
console.log('ERROR - not 100% its: ', abRoundedSum, '%')
console.log('Problem pair: a ', a, '=> ', aRounded, ' b ', b, '=> ', bRounded)
}
}
}