How do I publish entries with a specific category id? How do I publish a list of three most recent entries within a 'blog' section that feature the category id '42'?

I presently have this code:

{% for entry in craft.entries.section('blog').limit(3).find() %}
    &lt;li&gt;
        &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
    &lt;/li&gt;
{% endfor %}


However, I am having trouble properly implementing the .relatedTo() filter within this snippet, and all of the examples that I have read reference a category title rather than id.
You can pass in a CategoryModel to the relatedTo parameter, so its just a matter of getting the CategoryModel you're after. Something like:

{% set category = craft.categories.id(42).first %}
{% set entries = craft.entries.section('blog').limit(3).relatedTo(category) %}