for i ← 2 to N: P[i] ← 1 for j ← 4, 6, 8, ... N-1: P[j] ← 0 for i ← 3, 5, 7, ... sqrt(N): # Nの平方根まで if P[i] = 0: continue # continue文は残りの処理を無視して当該繰り返し処理の次のステップへ移ります for j ← i*2, i*3, ..., N-1: P[j] ← 0