May 5, 2026 Final

Problem 2 · The largest zigzag

Greedy digit-by-digit construction avoiding three monotone digits.

Integer answer, at most 4 digits

A positive integer is called a zigzag number if it satisfies the following three conditions:

  1. Its digits are nonzero and all different.
  2. It has no three consecutive digits in ascending order.
  3. It has no three consecutive digits in descending order.

For example, 14385 and 2917 are zigzag numbers but 2564 and 71544 are not. What is the largest four-digit zigzag number?

Copa Cangur · SCM Easy Closed answer