Lesson 10: Prime and composite numbers

A prime number has only two factors, itself and one. A composite number has at least three factors, and sometimes a lot more.

Open reading material (PDF)

CountFactors

Count factors of given number n.

Difficulty Level: Easy

MinPerimeterRectangle

Find the minimal perimeter of any rectangle whose area equals N.

Difficulty Level: Easy

Flags

Find the maximum number of flags that can be set on mountain peaks.

Difficulty Level: Medium

Peaks

Divide an array into the maximum number of same-sized blocks, each of which should contain an index P such that A[P - 1] < A[P] > A[P + 1].

Difficulty Level: Medium