The fastest way to encode these dense bitpackings is almost certainly with the Chinese remainder theorem.
The standard way is to do it recursively - you can see my implementation here: https://github.com/hcarver/Netflix/blob/2136aa5d28a209f902d4...
https://en.wikipedia.org/wiki/Chinese_remainder_theorem#Gene...
For example, the 3, 5, 7 packing yields a closed form of 70a_1+21a_2+15a_3 (mod 105). Plugging in 2, 4, 3 like your example yields 59 directly.