This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originally from http://logn.org/2009/07/lazy-primes-sieve-in-python.html | |
# Updated for Python3 by Chris Fuller. | |
# The automated 2to3 translation doesn't work. The tricky bit is the heap item. | |
# This is a (int, object) tuple in the original module, but the second element | |
# becomes a map iterator in Python3, which does not compare, so an exception | |
# is raised when the heap is sorted. | |
# It turns out that the object in the original tuple is irrelevant to the sort | |
# (it compares by memory location, which isn't well defined!). The int deter- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ISC License (ISC) | |
# | |
# Copyright 2021 Christopher Fuller | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, | |
# provided that the above copyright notice and this permission notice appear in all copies. | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL | |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
OlderNewer