[Edu-sig] discrete math track (high school) + a sieve

kirby urner kirby.urner at gmail.com
Thu Nov 16 16:59:28 EST 2017


We've maybe seen this sieve before on edu-sig but I don't remember for
sure, and just came across it following links from Guido's blog.  So pithy!

# -*- coding: utf-8 -*-
"""
Created on Thu Nov 16 13:23:51 2017

Copied from:
http://www.mypy-lang.org/examples.html

"""

import itertools


def iter_primes():
     # An iterator of all numbers between 2 and
     # +infinity
     numbers = itertools.count(2)

     # Generate primes forever
     while True:
         # Get the first number from the iterator
         # (always a prime)
         prime = next(numbers)
         yield prime

         # This code iteratively builds up a chain
         # of filters...
         numbers = filter(prime.__rmod__, numbers)

for p in iter_primes():
    if p > 1000:
        break
    print(p)

-------

Also, anyone interested in debates regarding the future of high school math
might be interested in math-teach, likely to be frozen and/or disappeared
come first of next year.  Lots of politics (I'm not a listowner nor on
staff, have limited insight, see 2nd link below):

http://mathforum.org/kb/message.jspa?messageID=10283328

https://www.nctm.org/News-and-Calendar/Messages-from-the-President/Archive/Matt-Larson/NCTM-and-The-Math-Forum/


Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20171116/1cbcf6a9/attachment.html>


More information about the Edu-sig mailing list