You need divisibleby, a built-in django filter.
{% for p in posts %}
<div class="post width1 height2 column {% if forloop.counter0|divisibleby:4 %}first{% endif %}">
<div class="preview">
</div>
<div class="overlay">
</div>
<h2>p.title</h2>
</div>
{% endfor %}