optimize prime palendrome program.