// sieve check prime in the range 2..N //N = 500 enum 2000 N to show | cnt last i = cnt = 0 last = 0 for i 2 N if a[i] print i space last = i cnt = cnt + 1 nl print cnt space print last nl to sieve | p j q = p = 2 while p*p <= N j = p + p while j <= N a[j] = 0 j = j + p p = p + 1 while a[p] == 0 p = p + 1 to main | i = a = array (N + 1) a[1] = 0 for i 2 N a[i] = 1 sieve show //main