Python is awesome (Project Euler)

R

Roy Smith

If you haven't heard of it, you should check out Project Euler
(http://projecteuler.net/). It's a series of (currently) 408
math-oriented programming problems, of varying degrees of difficulty.

The tie-in to this group is just how many of them are trivial in Python.
There's a whole slew of them which become one-liners due to Python's
long int support. For example, http://projecteuler.net/problem=48.
Datetime made me feel like I was cheating when I did
http://projecteuler.net/problem=19.

When you work with something as cool as Python every day, sometimes you
lose sight of just how awesome it is. Thanks to everybody who has
worked to make Python possible.
 
A

Alex

Yes. Although sometimes I fear that we are becoming a society of
end-users who rely too much on the capability of our tools and fail to
take the time to understand the fundamentals upon which those tools are
based or cultivate the problem-solving skills that Project Euler
appears to be trying to hone.
 
G

Grant Edwards

Yes. Although sometimes I fear that we are becoming a society of
end-users who rely too much on the capability of our tools and fail to
take the time to understand the fundamentals upon which those tools are
based or cultivate the problem-solving skills that Project Euler
appears to be trying to hone.

That's probably pretty much what somebody said 10K years ago when
people started to specialize in different occupations and hunters
started getting their spear-points by bartering for them with dried
meat instead of everybody flaking their own out of chunks of flint.
 
R

Roy Smith

"Alex" <[email protected]> said:
Yes. Although sometimes I fear that we are becoming a society of
end-users who rely too much on the capability of our tools and fail to
take the time to understand the fundamentals upon which those tools are
based or cultivate the problem-solving skills that Project Euler
appears to be trying to hone.

Over the years, my understanding of the fundamentals of computing has
included C, assembler, microcoding, TTL logic design, transistor
circuits, and a bit of semiconductor physics.

I could certainly build you a full-adder or a flip-flop from a pile of
NAND gates. I *think* I could probably cobble together a NAND gate from
a pile of transistors (but I know I couldn't build a transistor from a
pile of sand). I'm very happy living at the top of the stack these days
:)

I guess the question is, what *is* a "fundamental"? There's lots of
stuff in Project Euler that is about picking the right algorithm.
There's even a pair of problems which are exactly the same problem,
except that one has a (much) larger data set. You can solve the first
with brute-force, but not the second. Algorithms will always be
fundamental.

But, is knowing how to do arbitrary precision arithmetic a fundamental?
I don't think so. Back with I started working with microprocessors,
knowing how to do multi-precision addition was essential because you
only had an 8-bit adder. But those days are long gone.

There's a problem I just worked where you need to find the last 10
digits of some million-digit prime. Python's long ints don't help you
there. What does help you is figuring out a way to solve the problem
that's not brute-force. I think that's what Euler is all about.
 
R

Ramchandra Apte

If you haven't heard of it, you should check out Project Euler

(http://projecteuler.net/). It's a series of (currently) 408

math-oriented programming problems, of varying degrees of difficulty.



The tie-in to this group is just how many of them are trivial in Python.

There's a whole slew of them which become one-liners due to Python's

long int support. For example, http://projecteuler.net/problem=48.

Datetime made me feel like I was cheating when I did

http://projecteuler.net/problem=19.



When you work with something as cool as Python every day, sometimes you

lose sight of just how awesome it is. Thanks to everybody who has

worked to make Python possible.

Yup.
 
N

Neil Cerutti

There's a problem I just worked where you need to find the last
10 digits of some million-digit prime. Python's long ints
don't help you there. What does help you is figuring out a way
to solve the problem that's not brute-force. I think that's
what Euler is all about.

I agree. The most interesting part of participating is finding
out how my solution could've been improved or just completely
replaced with zero programming in some memorable cases. My
algebra has gotten a major workout, and I've had to resurrect the
mostly-dead neurons in my skull in charge of calculus.

Participants sometimes come up with terrible failures that
nevertheless find the solution (I'm no exception, though I think
I learn my lesson in the discussion groups). It's a limitation of
the way answers are checked. Working to make a solution that's
complete and extensible yields the most educational benefits, I
think.
 
R

Roy Smith

Neil Cerutti said:
I agree. The most interesting part of participating is finding
out how my solution could've been improved

Yeah, tell me about it. I was feeling pretty good about solving a
three-digit problem (http://projecteuler.net/problem=104). I made some
(so I thought) clever optimizations and got the answer in a little over
a minute of run time.

Then I looked at the discussion thread and discovered people were
reporting their solution times in milli-seconds :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top