1997 AMC 12 Problem 30

Attempt Problem 30 of the 1997 AMC 12 below, then check your answer against the professionally curated solution from LIVE by Po-Shen Loh. You can also try the full timed exam, view all 1997 AMC 12 solutions, or check the answer key.

All problems are used with official legal permission of the Mathematical Association of America (MAA).

30.

For positive integers n,n, denote by D(n)D(n) the number of pairs of different adjacent digits in the binary (base two) representation of n.n. For example, D(3)=D(112)=0,D(3)=D(11_2)=0, D(21)=D(101012)=4,D(21)=D(10101_2)=4, and D(97)=D(11000012)=2.D(97)=D(1100001_2)=2. For how many positive integers nn less than or equal to 9797 does D(n)=2?D(n)=2?
1616
2020
2626
3030
3535
Answer: C
Concepts:binary representationcombinations
Small hint:
A valid binary numeral consists of a block of 11s, then 00s, then 11s
Big hint:
Count by bit length through six bits, then handle the seven-bit cutoff 97=1100001297=1100001_2 separately
Solution:
A dd-bit numeral with exactly two changes has form 1a0b1c1^a0^b1^c with positive a,a, b,b, c,c, giving (d−12)\binom{d-1}{2} choices. For d=3,d=3, d=4,d=4, d=5,d=5, d=6,d=6, the total is 1+3+6+10=20.1+3+6+10=20. Among seven-bit numbers at most 11000012=97,1100001_2=97, the five forms beginning with one 11 all work, and the only form beginning with at least two 11s is 110000121100001_2 itself. Thus there are 20+6=26,20+6=26, and C is correct.
LIVE by Po-Shen Loh
Programs

LIVE Classes

Self-Paced Classes

Stars

Scholarship

About Us

Who Is Po-Shen Loh?

Email Contact

Newsletter

Jobs

Become a Star

For a more Thought Full world.

© 2026 Expii, Inc.