If n ≤ 0, return false.
While n > 1: if n mod 2 ≠ 0, return false. Otherwise divide n by 2.
If you exit the loop with n = 1, return true.
(Loop until n becomes 1)
If n ≤ 0, return false.
While n > 1: if n mod 2 ≠ 0, return false. Otherwise divide n by 2.
If you exit the loop with n = 1, return true.