: <fast-range> ( a b step -- range ) >r over - r> [ /i ] keep range boa ; inline :: nsieve ( n -- pi(n) ) [let | xs [ n [ 1 ] B{ } replicate-as ] | 0 0 xs set-nth-unsafe 0 1 xs set-nth-unsafe xs [ swap 1 = [| i | i 2 * n 1 - i <fast-range> [ 0 swap xs set-nth-unsafe ] each i ] when drop ] each-index xs 0 [ + ] reduce ] ;

Done