[Edu-sig] project Euler

Edward Cherlin echerlin at gmail.com
Thu Feb 12 18:46:22 CET 2009


2009/2/11 michel paul <mpaul213 at gmail.com>:
> This is a pretty cool site:  Project Euler.
>
> It's a list of problems that can't be solved using mathematical cleverness
> alone - they require programming.

Not so, according to the examples below.

> After you solve a problem, you then get
> access to the list of previous solutions.
>
> The first one - "Add all the natural numbers below one thousand that are
> multiples of 3 or 5." - is just a Python one-liner.

It's a shorter APL one-liner, but so what?

Sum of multiples of three (3-999), plus multiples of five (5-995),
minus multiples of 15 (15-990). No programming required.

> The second - "Find the sum of all the even-valued terms in the Fibonacci
> sequence which do not exceed four million."

Sum of every third term in the sequence. Set x=phi^3 and sum 2×(1 + x
+ x^2...) up to floor log 4e6 base x, and round the result. Also no
programming.

> It's fun looking at the previous solutions in all kinds of other languages.
> Really shows the elegance of Python.
>
> It reminds me somewhat of JavaBat.  There was some discussion earlier about
> doing something similar in Python?
>
> - Michel
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
>



-- 
Silent Thunder (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) is my name
And Children are my nation.
The Cosmos is my dwelling place, The Truth my destination.
http://wiki.sugarlabs.org/go/User:Mokurai (Ed Cherlin)


More information about the Edu-sig mailing list