Originally posted by BigMackCam Are you using this lens on a Pentax K-mount camera, or a different camera with M42 adapter? If the latter, are you sure that the M42 adapter's tolerances are correct? Is it allowing other M42-mount lenses to focus to infinity? Is the lens screwing in fully to the adapter? If not, it will sit slightly too far from the sensor, and that will prevent infinity focus.
Originally posted by Dartmoor Dave As Mike (@BigMackCam) says, if you're using an adapter on a non-Pentax camera that's the most likely cause and a better made adapter is the solution.
Further to the above... In addition to my Pentax gear, I shoot a Sony A7 MkII. I remember an M42 adapter I bought for it - quite a nicely-made one, not the typical rubbish - with which none of my M42 lenses would focus to infinity. I found that the thread ring was glued in (not sure why, as it was also secured with inset grub screws as is usually the case) and the amount of adhesive was sufficient that the ring was sitting too far forward. It took me an age to remove the glue... not sure what it was, perhaps a superglue of some kind... but once I'd done so, cleaned everything up and set the ring back in the mount, it worked perfectly...