# Finding the ball

There are $N$ balls such that out of these balls only one ball is heavier. We have one balance scale. With it we can know which of two ball groups is heavier. Balls get damaged when weighed, so each ball can take part in a weighing at most $K$ times, where $K \geq 1$. Help find the minimal number of weighings after which we can find the heaviest ball.

Example: If $n = 19, k = 2$, the answer is 3.

Note: Balls cannot be distinguished in terms of appearance.

I know these kind of questions have appeared quite often and their answer is $\lceil log_3(N)\rceil$. But I wonder by restricting $K$ will there be any effect on the answer and why?

If $K = 1$, then you can weigh pairs of balls, one on each side of the scale, requiring up to $N/2$ (round down) weighings for $N$ balls.

For $K > 1$, you could use the standard technique of dividing the balls into 3 groups and weighing one group against another until you have narrowed it down to a set that can only be weighed one more time each. Then you must weigh those pairwise.

The optimization is different. For example, you can differentiate up to $9$ balls in $2$ weighings if $K \geq 2$, but if $K = 1$, you can only differentiate up to $5$ balls in $2$ weighings. Plan:

• Weigh #$1$ vs. #$2$.
• If different, the heavier one is the one.
• If same, weigh #$3$ vs. #$4$.
• If different, the heavier is the one.
• If same, #$5$ is the one.

Likewise, you can differentiate up to $27$ balls in $3$ weighings if $K \geq 3$, but if $K = 2$, you can only differentiate up to $19$ balls. Plan:

• Weigh $5$ balls on each side.
• If different, proceed with plan for weighing $5$ balls with $K=1$, $W=2$, as above.
• If same, weigh $9$ remaining balls as for $W=2$ and $K \geq 2$ (standard technique).

The maximum number of balls you can differentiate in $W$ weighings will be between $3^K$ and $3^W$.

Recursive formula for max number of balls you can differentiate in $W$ weighings for a given $K$:

$$M(K,W) = \begin{cases} 1, & K=0\\ 3^W, & K \geq W\\ M(K,W-1) + 2\cdot M(K-1,W-1), & K < W \end{cases}$$

Given a number of weighings $K$ the maximum number of balls $N$ is: $$N = \frac{3^K - 3}{2}$$

• but how to find the heaviest ball in minimum weighings? Jun 10 '14 at 15:05
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://math.stackexchange.com/questions/829237/finding-the-ball", "fetch_time": 1638538192000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2021-49/segments/1637964362879.45/warc/CC-MAIN-20211203121459-20211203151459-00398.warc.gz", "warc_record_offset": 447376032, "warc_record_length": 33488, "token_count": 667, "char_count": 2253, "score": 4.28125, "int_score": 4, "crawl": "CC-MAIN-2021-49", "snapshot_type": "latest", "language": "en", "language_score": 0.9146356582641602, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00061-of-00064.parquet"}