5 variables? base 10? 100.000 combinations? Does not sound as if you need anything better than brute force... edit: didn't see the P, that would be 1.000.000 combinations, which should still be quick ...
Some results have been hidden because they may be inaccessible to you
Show inaccessible results