Pack years = number of packs smoked per day × number of years as a smoker
Or, if you don't know how many packs but you do know how many cigarettes, then you calculate it using the number of cigarettes smoked per day × number of years smoked... all divided by 20 (this is assuming that one pack contains 20 cigarettes).
Also... if you are a fan of living forever (aren't we all?) or the book The Blue Zones, then check out this article (thanks M for letting me know about it!): How to Live Forever.