Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35851 > unrolled thread

Python is awesome (Project Euler)

Started byRoy Smith <roy@panix.com>
First post2012-12-31 09:18 -0500
Last post2013-01-02 05:12 -0800
Articles 7 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  Python is awesome (Project Euler) Roy Smith <roy@panix.com> - 2012-12-31 09:18 -0500
    Re: Python is awesome (Project Euler) "Alex" <foo@email.invalid> - 2012-12-31 16:46 +0000
      Re: Python is awesome (Project Euler) Grant Edwards <invalid@invalid.invalid> - 2012-12-31 17:36 +0000
      Re: Python is awesome (Project Euler) Roy Smith <roy@panix.com> - 2012-12-31 13:45 -0500
        Re: Python is awesome (Project Euler) Neil Cerutti <neilc@norwich.edu> - 2013-01-02 19:11 +0000
          Re: Python is awesome (Project Euler) Roy Smith <roy@panix.com> - 2013-01-02 21:38 -0500
    Re: Python is awesome (Project Euler) Ramchandra Apte <maniandram01@gmail.com> - 2013-01-02 05:12 -0800

#35851 — Python is awesome (Project Euler)

FromRoy Smith <roy@panix.com>
Date2012-12-31 09:18 -0500
SubjectPython is awesome (Project Euler)
Message-ID<roy-356AC0.09185931122012@news.panix.com>
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.

[toc] | [next] | [standalone]


#35852

From"Alex" <foo@email.invalid>
Date2012-12-31 16:46 +0000
Message-ID<kbsfh5$lp4$1@dont-email.me>
In reply to#35851
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.

[toc] | [prev] | [next] | [standalone]


#35853

FromGrant Edwards <invalid@invalid.invalid>
Date2012-12-31 17:36 +0000
Message-ID<kbsief$2u6$1@reader1.panix.com>
In reply to#35852
On 2012-12-31, Alex <foo@email.invalid> wrote:

> 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.

-- 
Grant Edwards               grant.b.edwards        Yow! Being a BALD HERO
                                  at               is almost as FESTIVE as a
                              gmail.com            TATTOOED KNOCKWURST.

[toc] | [prev] | [next] | [standalone]


#35854

FromRoy Smith <roy@panix.com>
Date2012-12-31 13:45 -0500
Message-ID<roy-23E484.13454431122012@news.panix.com>
In reply to#35852
In article <kbsfh5$lp4$1@dont-email.me>, "Alex" <foo@email.invalid> 
wrote:

> 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.

[toc] | [prev] | [next] | [standalone]


#36006

FromNeil Cerutti <neilc@norwich.edu>
Date2013-01-02 19:11 +0000
Message-ID<akjf2sFsiv8U3@mid.individual.net>
In reply to#35854
On 2012-12-31, Roy Smith <roy@panix.com> wrote:
> 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.

-- 
Neil Cerutti

[toc] | [prev] | [next] | [standalone]


#36023

FromRoy Smith <roy@panix.com>
Date2013-01-02 21:38 -0500
Message-ID<roy-F0D481.21381902012013@news.panix.com>
In reply to#36006
In article <akjf2sFsiv8U3@mid.individual.net>,
 Neil Cerutti <neilc@norwich.edu> wrote:

> On 2012-12-31, Roy Smith <roy@panix.com> wrote:
> > 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

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 :-(

[toc] | [prev] | [next] | [standalone]


#35977

FromRamchandra Apte <maniandram01@gmail.com>
Date2013-01-02 05:12 -0800
Message-ID<6df7a11c-ca9d-41af-8dbe-0110842a6220@googlegroups.com>
In reply to#35851
On Monday, 31 December 2012 19:48:59 UTC+5:30, Roy Smith  wrote:
> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web