## Riddler Express

#### By Zach Wissner-Gross

From Mark Hannan comes a holiday party stumper:

You’re new at your job, and your office is voting on a theme for its holiday party. It’s fallen on you to record the percent of your coworkers (including yourself) who voted for each one. Well, since you’re in a hurry, you just write down everything in the percentage that comes before the decimal point. So for example, 35.0 percent, 35.17 percent and 35.92 percent would all be written simply as “35 percent.”

After the votes are tallied, you found that the winner received 73 percent of the vote (at least, that’s what you wrote down), while second place had 58 percent, and third place had 32 percent. Your first realization is that you work with a bunch of cheaters who voted more than once. But your second thought is that you might be able to use this information to figure out how many people work in your office. (As I said, you’re new, and this isn’t something you know off the top of your head.)

Based on these percentages, what’s the minimum number of people who could work in your office?

Extra credit: Your office could be filled with many possible numbers of people. Based on the percentages given in the problem, what’s the greatest number of people your office can’t have?

## My Solution

To find how many $$x$$ number of people work in the office, we just need to find all values of $$x$$ in this system of equations that result in whole numbers for $$a$$, $$b$$, and $$c$$:

$\begin{cases} 0.32x \leq a \leq 0.33x \\ 0.58x \leq b \leq 0.59x \\ 0.73x \leq c \leq 0.74x \end{cases}$

We just need to find the lowest number of people in the office, so we can just run through for all positive integers of $$x$$ from $$1$$ to $$1000$$ (anything greater than that is absurd; no office party can host that many people), with a resolution of $$0.000001$$ between each percentage point (that seems sufficiently small enough).

for (x in 1:1000) {
testA <- c()
for (a in seq(0.33,0.34,0.000001)) {
if ((x*a) %% 1 == 0) {
testA <- c(testA,x*a)
}
}
testB <- c()
for (b in seq(0.58,0.59,0.000001)) {
if ((x*b) %% 1 == 0) {
testB <- c(testB,x*b)
}
}
testC <- c()
for (c in seq(0.73,0.74,0.000001)) {
if ((x*c) %% 1 == 0) {
testC <- c(testC,x*c)
}
}
if (length(testA) != 0 && length(testB) != 0 && length(testC) != 0) {
print(paste("There can be ", x, " people in the office.", sep=""))
print("Votes for option A:")
print(testA)
print("Votes for option B:")
print(testB)
print("Votes for option C:")
print(testC)
}
}
## [1] "There can be 100 people in the office."
## [1] "Votes for option A:"
## [1] 33 34
## [1] "Votes for option B:"
## [1] 59
## [1] "Votes for option C:"
## [1] 73 74
## [1] "There can be 125 people in the office."
## [1] "Votes for option A:"
## [1] 42
## [1] "Votes for option B:"
## [1] 73
## [1] "Votes for option C:"
## [1] 92
## [1] "There can be 200 people in the office."
## [1] "Votes for option A:"
## [1] 66 67 68
## [1] "Votes for option B:"
## [1] 117 118
## [1] "Votes for option C:"
## [1] 146 147 148
## [1] "There can be 250 people in the office."
## [1] "Votes for option A:"
## [1] 83 84 85
## [1] "Votes for option B:"
## [1] 145 146 147
## [1] "Votes for option C:"
## [1] 183 184 185
## [1] "There can be 300 people in the office."
## [1] "Votes for option A:"
## [1] 99
## [1] "Votes for option B:"
## [1] 174 177
## [1] "Votes for option C:"
## [1] 219 222
## [1] "There can be 320 people in the office."
## [1] "Votes for option A:"
## [1] 106 108
## [1] "Votes for option B:"
## [1] 187
## [1] "Votes for option C:"
## [1] 234 235
## [1] "There can be 400 people in the office."
## [1] "Votes for option A:"
## [1] 132 133 134 135 136
## [1] "Votes for option B:"
## [1] 234 236
## [1] "Votes for option C:"
## [1] 292 293 294 295 296
## [1] "There can be 450 people in the office."
## [1] "Votes for option A:"
## [1] 153
## [1] "Votes for option B:"
## [1] 261
## [1] "Votes for option C:"
## [1] 333
## [1] "There can be 500 people in the office."
## [1] "Votes for option A:"
## [1] 165 166 167 168 169 170
## [1] "Votes for option B:"
## [1] 290 291 292 293 294 295
## [1] "Votes for option C:"
## [1] 365 366 367 368 369 370
## [1] "There can be 550 people in the office."
## [1] "Votes for option A:"
## [1] 187
## [1] "Votes for option B:"
## [1] 319
## [1] "Votes for option C:"
## [1] 407
## [1] "There can be 600 people in the office."
## [1] "Votes for option A:"
## [1] 198 201
## [1] "Votes for option B:"
## [1] 348 351 354
## [1] "Votes for option C:"
## [1] 438 441 444
## [1] "There can be 625 people in the office."
## [1] "Votes for option A:"
## [1] 207 210 211 212
## [1] "Votes for option B:"
## [1] 363 365 366 368
## [1] "Votes for option C:"
## [1] 457 458 460 461 462
## [1] "There can be 640 people in the office."
## [1] "Votes for option A:"
## [1] 212 216
## [1] "Votes for option B:"
## [1] 374
## [1] "Votes for option C:"
## [1] 468 470
## [1] "There can be 700 people in the office."
## [1] "Votes for option A:"
## [1] 231
## [1] "Votes for option B:"
## [1] 406 413
## [1] "Votes for option C:"
## [1] 511 518
## [1] "There can be 750 people in the office."
## [1] "Votes for option A:"
## [1] 249
## [1] "Votes for option B:"
## [1] 438 441
## [1] "Votes for option C:"
## [1] 549 552 555
## [1] "There can be 800 people in the office."
## [1] "Votes for option A:"
## [1] 264 265 266 267 268 269 270 271 272
## [1] "Votes for option B:"
## [1] 467 468 471 472
## [1] "Votes for option C:"
## [1] 584 585 586 587 588 589 590 591 592
## [1] "There can be 900 people in the office."
## [1] "Votes for option A:"
## [1] 297 306
## [1] "Votes for option B:"
## [1] 522 531
## [1] "Votes for option C:"
## [1] 657 666
## [1] "There can be 950 people in the office."
## [1] "Votes for option A:"
## [1] 323
## [1] "Votes for option B:"
## [1] 551
## [1] "Votes for option C:"
## [1] 703
## [1] "There can be 960 people in the office."
## [1] "Votes for option A:"
## [1] 318 324
## [1] "Votes for option B:"
## [1] 561
## [1] "Votes for option C:"
## [1] 702 705
## [1] "There can be 1000 people in the office."
## [1] "Votes for option A:"
##  [1] 330 331 332 333 334 335 336 337 338 339 340
## [1] "Votes for option B:"
##  [1] 580 581 582 583 584 585 586 587 588 589 590
## [1] "Votes for option C:"
##  [1] 730 731 732 733 734 735 736 737 738 739 740