Python is awesome (Project Euler)

Discussion in 'Python' started by Roy Smith, Dec 31, 2012.

  1. Roy Smith

    Roy Smith Guest

    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.
    Roy Smith, Dec 31, 2012
    #1
    1. Advertising

  2. Roy Smith

    Alex Guest

    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.
    Alex, Dec 31, 2012
    #2
    1. Advertising

  3. On 2012-12-31, Alex <> 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.
    Grant Edwards, Dec 31, 2012
    #3
  4. Roy Smith

    Roy Smith Guest

    In article <kbsfh5$lp4$>, "Alex" <>
    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.
    Roy Smith, Dec 31, 2012
    #4
  5. 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.
    Ramchandra Apte, Jan 2, 2013
    #5
  6. Roy Smith

    Neil Cerutti Guest

    On 2012-12-31, Roy Smith <> 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
    Neil Cerutti, Jan 2, 2013
    #6
  7. Roy Smith

    Roy Smith Guest

    In article <>,
    Neil Cerutti <> wrote:

    > On 2012-12-31, Roy Smith <> 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 :-(
    Roy Smith, Jan 3, 2013
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bruno Desthuilliers
    Replies:
    30
    Views:
    1,070
    paulhankin
    Sep 19, 2007
  2. eliben
    Replies:
    3
    Views:
    577
    Mensanator
    Feb 18, 2009
  3. vsoler
    Replies:
    24
    Views:
    845
    Steven D'Aprano
    Nov 11, 2009
  4. Panagiotis Atmatzidis
    Replies:
    7
    Views:
    137
    Giampiero Zanchi
    Dec 21, 2009
  5. scripts examples

    python scripts solution for euler projects

    scripts examples, Feb 29, 2012, in forum: Python
    Replies:
    2
    Views:
    239
    scripts examples
    Mar 1, 2012
Loading...

Share This Page