Engineering & Technology
Mahasiswa
請問有沒有大神會翻成程式碼?
我看不懂
Sieve algorithm
1.1 What Is an Algorithm?
33
for p 2 to n do A[p] - P
for p < 2 to [n] do //see note before pseudocode
if A[p]+0 llp hasn't been eliminated on previous passes
jr p * P
while j < n do
A[j]0 //mark element as eliminated
j<j+ p
I/copy the remaining elements of A to array L of the primes
if( 0
for p + 2 to n do
if A[p] = 0
L[i] + A[p]
iki +1
return L
Answers
No answer yet
Apa kebingunganmu sudah terpecahkan?
Pengguna yang melihat pertanyaan ini
juga melihat pertanyaan-pertanyaan ini 😉