How criminal gangs could be stopped by maths