Prime algorithm in GPU with reduction algorithms