All useful code for prime related operation