next up previous
Next: Up: Previous:

Examples

The following example illustrates the concept of reducibility. Consider three problems, A, B, and C:

In this example A \(\leq_P\) C, and B \(\leq_P\) C. Why?

To find if n is a prime, we attempt to divide it by 2, 3, 5, etc. The smallest integer that divides n also answers A.

Thus the solution of Smallestfactor(n) tells us that n is not a prime.

To see how B \(\leq_P\) C we need a simple algorithm that counts the number of distinct divisors of n using C.


next up previous
Next: Up: Previous: