[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [seul-edu] Programming Mathematics
Roger Dingledine wrote:
>
> I'll answer some of these in perl, as sparetime fun programming things.
> But remember that the motto of perl is 'there's more than one way to
> do it'. So only post optimizations if they are substantially better
> (faster and more readable) than my code. ;) (And I reserve the right to
> kill this thread if it gets too pedantic.)
> (I didn't deal with some end-cases. So these snippets aren't as robust
> as they could be.)
....
> hope this helps. only expmod, is_prime, and print_factors are remotely
> publishable... the rest is just glue.
> --roger
Thanks, Roger, I'll add these to my growing list. Besides the posts
here, I've had luck going to programming and math books. One of my
favorite books is "Number Theory" by George E. Andrews, a professor
at Penn. State. There is a small section on "The Use of Computers
in Number Theory" with some good suggestions for programming projects.
Speaking of being pedantic, one of the projects is to find all of
the "perfect numbers" between 2 and 500. A number is "perfect" if
the sum of all the divisors of the number (not including
the number itself) add up to the number. So 6 is a perfect number
since 1 + 2 + 3 = 6. 28 is perfect since 1 + 2 + 4 + 7 + 14 = 28.
Once you find the list of perfect numbers then you go looking for
patterns in the numbers that might predict the nth perfect number.
A curious property of perfect numbers is that the sum of the
reciprocals of the divisors of a perfect number add up to 2. Odd.
1 + 1/2 + 1/3 + 1/6 = 2. Sorry! I just couldn't help mentioning
it!
The classic books by Donald Knuth on the "Art of Programming" have
a lot of other interesting examples. Another interesting book I have
found is "Number Theory in Science and Communication", by M.R.
Schroeder. This book is great. It describes "noble" numbers as numbers
whose continued fraction expansions end in infinitely many 1's and
relates them to the rings of Saturn. (You'll be gone for days
thinking about that one.) The mathematics journals put out by the
MAA and the AMA are also providing some good examples.
If you are into this topic as a hobby or because you can't help it,
you can get these books and journals at the library or go down to
Borders Books - a truly enlightened bookstore. They carry Linux
software, books, and give teachers a 20% discount.
lp