I would strongly suggest you do that at a camera store. Here is, though, some idea of how it's done (excerpt from another post on a different forum):
It might be possible to just remove the Nikon flange from the back of the lens and replace it with a Pentax flange; both are very simple parts and similar in general design. you could get a mounting flange off of a cheap K-mount teleconverter easily enough, and since the focus register of the Pentax is 1mm shorter than the Nikon, you shouldn't have any infinity-focus problems.
Try SRB (www.srbfilm.co.uk). They advertise a number of adaptors, Nikon to Pentax K is not on the current list but they will be able to advise if the lens can be modified.
note that the Tamron lenses were designed to be used with adaptors; the lenses all had a common mount and you had to buy an appropriate adaptor to fit them to specific cameras. This made changing camera systems easy because you just bought new adaptors. Changing a lens with a dedicated mount can be much more complicated (and expensive) and usually involves loss of some lens functions such as the ability to focus at infinity, connection to the metering system etc.