Author: | b |
---|---|

Mode: | factor |

Date: | Sat, 27 Sep 2008 18:37:27 |

:: primes ( n -- pi(n) ) [let | xs [ n [ 1 ] B{ } replicate-as B{ 0 0 } prepend ] primes [ H{ } clone ] ppairs [ H{ } clone ] | xs length sqrt ! >integer [ dup xs nth 1 = [| i | i 2 * n 1 - i <range> [ 0 swap xs set-nth ] each i ] when drop ] each xs [ 1 = [ 1 swap primes set-at ] [ drop ] if ] each-index primes [ drop 99999 > ] assoc-filter ] ;

Summary: | |
---|---|

Author: | |

Mode: | |

Body: | |