Answer:
31 pencils
Step-by-step explanation:
What we must do is reduce the range of responses, the first thing is to limit the numbers to the interval between 30 and 40.
If it is two by two and there is one left, it means that all the pairs are eliminated.
If it is five in five and there is one left over, the ones ending in 5 are also eliminated.
If it is three by three and there is one left over, the 33 and 39 are eliminated.
Taking this into account, the possibilities are reduced to two numbers only, 31 and 37.
37 is discarded because when it is grouped from five to five, there are 2 left over.
So the answer is 31, you have 31 pencils.