Given a number d, find a fraction of the form p/q with q at most equal to d which is closest to π.
For example 22/7 is the closest with d=10.
Here, we define π as the smallest positive number such that sin(π)=0. Moreover, we can assume that we already know that π lies between 3 and 4.
Hint: Near π the sine function decreases linearly. Hence, the value of |sin(p/q)| can be taken to be a measure of how close p/q is to π when p/q is near π.