Optimized version of bruteForce.py using a lookup table added