The Grey Wolf Optimizer (GWO) is a swarm intelligence meta-heuristic algorithm inspired by the hunting behaviour and social hierarchy of grey wolves in nature. This paper analyses the use of chaos theory in this algorithm to improve its ability to escape local optima by replacing the key parameters by chaotic variables. The optimal choice of chaotic maps is then used to apply the Chaotic Grey Wolf Optimizer (CGWO) to the problem of factoring a large semi prime into its prime factors. Assuming the number of digits of the factors to be equal, this is a computationally difficult task upon which the RSA-cryptosystem relies. This work proposes the use of a new objective function to solve the problem and uses the CGWO to optimize it and compute the factors. It is shown that this function performs better than its predecessor for large semi primes and CGWO is an efficient algorithm to optimize it.