# [Edu-sig] Programming in High School

kirby urner kirby.urner at gmail.com
Wed Dec 10 19:19:41 CET 2008

```2008/12/10 michel paul <mpaul213 at gmail.com>:

<< SNIP >>

> There is a big contrast between doing math the traditional way, solving
> equations by manipulating symbols in some boolean assertion to isolate a
> variable, vs. thinking computationally - creating sets of functions to model
> concepts.  Introducing this stuff eventually requires rethinking the whole
> curriculum.  But one step at a time.
>
> - Michel

Yes Michel, but let's remember "schoolish math" isn't necessarily what
the pros are doing to earn a living, with Mathematica, MathCad or
whatever.  Lots of degree holders in mathdom spend half their time
talking to coders with humanities degrees like me, explaining what
outputs from what inputs, in terms of algorithms per Knuth, i.e. the
stuff you learn in K-12 isn't "computer poor" because of anything to
do with real world mathematics in practice.

The way I might do it in Portland (write ups in blogs) is take what
we'd consider an advanced, college level theorem, such as Fermat's
Little (not Last), and use Python to verify what it asserts, not the
same thing as proving.  What I say often @ Math Forum is something
like:  before you prove a theorem, you need to know what it means,
i.e. you need to care.  Having field applications helps motivate
caring.  We might not ever get to the proof in this class (heresy!)
as these are underclassmen looking to understand RSA, haven't
chosen to become mathematicians.

What's so cool about Python is pow(2, 22, 23) is so easy to write
and explain (no import required), whereas on a calculator you get
digit overflow most the time, because of the overly small LCDs,
hamster-brained programs (not open source).

Per my Chicago talk, OSCONs before it, Texas Instruments is our
only real competition in this picture in a business case sense,
though "fear of snakes" (per 'Snakes on a Plane') is probably the
biggest psychological barrier.  North Americans are especially
superstitious about snakes, owing to their making Eve do something
bad in the Bible (what was it again?).  Ruby has an edge in that
sense (less charged) -- but then we have a Flying Circus, which
helps a lot.

We basically invite kids to "fill in the form":  pow(2, prime - 1, prime)
and verify that they always get 1 for an answer.  Then comes the
tricky part:  does that mean that if pow(2, n-1, n) returns 1, that
n must be prime?  Having verified it's true for like a gazillion primes,
the overly casual thinker might say "sure!".  But of course this is
a logical pitfall.  "if a then b" does not support "b therefore a".
That's where we talk about Carmichael numbers, look them up
on the web (OEIS).

Fermat's Little is a special case of Euler's more general one about
totients (lots of fun Python), in turn critical for getting RSA to work
(per Knuth).  All before college, looks good on your application
(that you went to this cutting edge Quaker school or whatever).

Kirby
4D
```