|Subject:||Re: [Edu-sig] Updating some more...|
|Date:||Wed, 30 Jun 2010 21:49:07 -0400|
At 07:01 PM 6/30/2010, kirby urner wrote:
I did something similar with a Ramanujan series converging to pi...
Since you mentioned Ramanujan...
He and Hardy worked quite a bit on the partition function: p(n) = the number of different ways n can be represented as a sum of positive integers. The sequence p(n) starts like Fibonacci numbers, 1, 1, 2, 3, 5... but the next one is 7. Nice try!
At some point around 1916, an amature mathematician Major MacMahon, who was "good with numbers" calculated _by hand_ for Hardy and Ramanujan p(n) for n = 1 through 200. p(200) happens to be 3,972,999,029,388. An interesting story.
It is possible, of course, to write a recursive function to calculate p(n), but a more fun way is to use the generating function (1 + x + x^2 +x^3+...x^n)*(1+x^2+x^4+x^6+...)(1+x^3+x^6+...)*...*(1+x^n) (due to Euler, as most everything else...) When you distribute, the coefficients at x, x^2, ... of the resulting polynomial give you p(1), p(2), ... So this could be a basis for a meaningful project on lists and polynomials.
If you plug a large enough number into the generating function, say, x = 10000, you get a number whose groups of five digits (from the right) give you p(n) as long as p(n) < 10000. So for a relatively small n instead of multiplying polynomials you can multiply "periodic" integers 100010001...0001*100000001...00000001*...
It is easy, of course, to generate these numbers using strings. Then this becomes a meaningful exercise on strings.
I am currently working on a "test package" for the Math and Python book and I've just added a question based on a small peace of this, so I felt like sharing. Not sure whether this is for the left brain or for the right brain; these periodic strings are kinda cute. :)
_______________________________________________ Edu-sig mailing list Edu-sig@xxxxxxxxxx http://mail.python.org/mailman/listinfo/edu-sig
|<Prev in Thread]||Current Thread||[Next in Thread>|
|Next by Date:||Re: [Edu-sig] Updating some more..., kirby urner|
|Next by Thread:||Re: [Edu-sig] Updating some more..., kirby urner|
|Indexes:||[Date] [Thread] [Top] [All Lists]|