:: primes ( n  pi(n) )
[let 
xs [ n [ 1 ] B{ } replicateas B{ 0 0 } prepend ]
primes [ H{ } clone ]
ppairs [ H{ } clone ]

xs length sqrt ! >integer
[ dup xs nth 1 =
[ i 
i 2 * n 1  i [ 0 swap xs setnth ] each i
] when drop
] each
xs [ 1 = [ 1 swap primes setat ] [ drop ] if ] eachindex
primes [ drop 99999 > ] assocfilter
] ;