Approximate the value of lg(1,000,000) to the nearest integer.
Answer: 20.
2^10 = 1024 approx 10^3.
2^20 = (2^10)^2 approx (10^3)^2 = 10^6 = 1,000,000.
If you have an array of 5 unique numbers, what is the probability that they are already sorted in ascending order?
Answer: 1/120.
There are 5! = 120 permutations. Only 1 is sorted.
Identify the input and output for the "Primality Testing" problem.
Input: A positive integer n.
Output: Boolean (True if n is prime, False otherwise).