I have recessed lights and the light on one of them only lasts around 2-3 weeks all the other lights on the same circuit works just fine
Both of those answers may be correct.
It is most likely that the arcing would be in the socket itself. Obviously heat generated in the junction box is not as likely to damage the bulb as heat generated between the bulb and the socket. And if the circuit wiring were involved, other bulbs would be burning out too (from excessive ultra fast "flickering"). In that regard, a common problem is that the "tab" in the middle of the socket can get compressed so that the light bulb is not making good contact with that tab when you screw it in. Needless to say, screwing the bulb tighter and tighter will, over time, make the situation worse. Fortunately, it's an easy fix, BUT you must turn off the lights ...and if you are not comfortable with electricity, turn off the breaker.
- Turn OFF the light.
- Using an insulated (or taped up) flat head screw driver, poke up inside the socket and press against the end of the tab so that it bends slightly outward toward you.
If there is a loose connection that is arcing, that is serious. If you can't find the problem, install an AFCI circuit breaker and monitor the situation by bypassing different connections to see if one of them trips the AFCI.
I had this same problem and, I think, I traced it to vibration from the floor above. Replaced with LED four years ago and the problem has been fixed. Make sure your LED replacement bulbs have the proper color temperature! 2700K matches incandescent and is nice and warm.