CAT Quantitative Ability: Functions · B18Q-04

TITA · Hard

A function on the positive integers satisfies f(1) = 1, f(2n) = f(n) and f(2n + 1) = f(n) + 1 for every n ≥ 1. For how many n with 1 ≤ n ≤ 63 is f(n) = 3?

Type in the answer (TITA): no options.

Show answer & solution

Correct answer: 20

Solution: Halving n (dropping a final 0 in binary) keeps f the same, and n = 2m + 1 (a final 1) adds 1, so f(n) is the number of 1s in the binary form of n. The numbers 1 to 63 are exactly the non-zero 6-bit strings, and those with exactly three 1s number C(6, 3) = 20.
⚑ Report an error

Similar questions