discrete math track (high school) + a sieve

kirby urner <[email protected]>
Newsgroups gmane.comp.python.education
Message-ID <CAPJgG3T0FXWJf6gU5qc+5zUTZQGnjp+PwxYBgEpvuQpw81oTaA@mail.gmail.com>
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

_______________________________________________
Edu-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/edu-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.