How many pillars do we need to surround a triangular area? Suppose, I have a triangular garden with sides of $25$ feet, $40$ feet and $55$ feet. If I want to surround my garden with pillars set $5$ feet apart, how many pillars will I need?
I calculated the triangle's perimeter and divided it by $5$. I got 24.
Since it is a enclosed area, I will need one less pillar. So I will need a total of $23$ pillars.
But someone suggested me that I actually need $22$ pillars, but he didn't explain why. So am I miscalculating something?
 A: Small example first to see what is going on. If we have to cover a perimeter of $15$ feet, we would need $3+1$ pillars if it would be a straight line. Notice $15/5=3$, which corresponds to the number of gaps between the poles. It would look like:
$$ \underbrace{\Big| \text{5 feet}\Big| \text{5 feet}\Big|\text{5 feet}\Big|}_{15 \text{ feet }} $$
We see that there is one more pillar than there are gaps.
However, we have $3$ pillars if the endpoints were to be connected (which is the case for our triangle). Since when we get back to the starting point we see that we have already placed a pillar there.
Indeed $25+40+55=120$ then $120/5=24$. If we were to place them along a line we would have to place $25$ pillars, but for our triangle the endpoints overlap so we only need $24$ pillars.
A: Your reasoning for $23$ pillars seems to be flawed, as explained in another answer. This is a variation of the classic "fencepost" problem.
So if the requirement is that the pillars must be five feet apart measured along the perimeter, you need $24$ pillars, and $23$ are not sufficient.
But if the requirement is merely that each pillar must be no more than $5$ feet from two others, then there is a trick answer.
First put a pillar at each vertex of the triangle and at intervals of $5$ feet along each side. This takes $24$ pillars.
Next, let's look at the vertex between the sides of length $25$ and $55$.
The angle between these sides is slightly less than $42$ degrees.
If we look at the pillars $5$ feet away from the vertex on each side, those two pillars are less than $3.6$ feet apart. So you can take away the pillar at the vertex and still have every pillar no more than $5$ feet from two others.
Now let's look at the vertex between the sides of length $40$ and $55.$
The angle between these sides is slightly less than $25$ degrees.
If we look at the pillars $10$ feet away from the vertex on each side, those two pillars are less than $4.3$ feet apart. So you can take away the pillar at the vertex and the two pillars $5$ feet from the vertex, and still have every pillar no more than $5$ feet from two others.
According to this interpretation, then, you can remove $4$ pillars from the original $24$ (one at one vertex, three at or near the other vertex) and enclose your garden with $20$ pillars spaced $5$ feet apart.
I don't imagine that this is the intended solution; it is just a play on the ambiguous statement of the question.
Indeed, one might ask how a set of pillars can "enclose" a garden when they are $5$ feet apart and one can simply walk in or out between two pillars.
To "enclose" a garden one might imagine using the pillars as fence posts
and stringing wires or rails or some other material between them.
In that case, if you only use $20$ pillars as suggested in my "trick" interpretation, the wires or rails will cut off two corners of the garden. To really enclose a garden by a fence using fence posts connected by straight line segments, you truly do need $24$ fence posts. If the sides had not been chosen to be multiples of $5$ but had been some other three random numbers adding to $120,$ for example $26, 40, 54,$ you would need more than $24$ fence posts in order to have one at every vertex.
A: 
Since it is a enclosed area, I will need one less pillar.

If you mean that it's a closed curve, it is true that closed curves need one fewer than open curves. However, you are mistaken in thinking that the number for open curves is p/d, and the number for closed curves is one less than that. Rather, the number for closed curves is p/d, and the number for open curves is one more than that.
The person who suggested $22$ seems to also be aware of this "off by one", but doesn't realize that you've already subtracted one.
One tactic when you're trying to remember how a rule works is to take a simple case. If you have a perimeter of 3 feet, and want a post every foot, how many posts you need?
