Next: Top down vs. Bottom
Up: CS101 Lecture 5
Previous: 235 problem
We first use the following simple method.
Suppose we know how to test if a given
number has the 235-property.
Call this piece test235(n).
It returns a logical value (yes/no, true/false).
Now, how to solve the counting problem?
Very high level:
- Start from 1 and test numbers one by one.
- Every time we find one, increment a counter (must initialize this to 0!)
- Before testing next number, check if we have found enough already.
G. Sivakumar
2000-08-06