Mike Molony is Solving Project Euler, Interactively

Our interactive Python trinkets were designed to be used in the classroom but users are finding many other creative ways to use them!  In this interview, Mike Molony describes how he’s been steadily working his way through Project Euler, a set of mathematical programming challenges, and blogging his interactive solutions using Trinket.  Enjoy!  

This is part of a periodic series of interviews we’re doing of educational innovators.  An archive of previous interviews can be found here.

Mike Molony

Elliott: Your blog has over 130 Python solutions (and counting!) to the 470+ Project Euler Problems listed on projecteuler.net. Could you briefly explain the Project and describe what inspired you to start blogging your way through it?

Mike: Project Euler (www.projecteuler.net) is a fantastic resource that provides problems, mostly with a mathematical tone, that helps teach you programming by solving problems. It wasn’t long before I discovered that most submitted solutions were 50-200 lines of code and took hours to execute. I wanted a forum that shared solutions taking fewer than 15 lines of Python and running in a fraction of a second. And, as I had hoped, I get many comments on how to improve my solutions even further. So, blogging my solutions has been a learning experience for me also.

“I wanted a forum to share solutions taking fewer than 15 lines of Python and running in a fraction of a second.”

Elliott: We’ve been very excited to see you using our Python trinkets in ways we hadn’t imagined. Your blog does a great job of teaching both Python and computational thinking. What reactions have you gotten from visitors on the new interactive solutions you’ve added?

Mike: The response has been outstanding and I am moving all my solutions to trinkets. Live interaction with Python programs allows anyone to experiment with the results by changing a few parameters, and helps them discover new methods they hadn’t thought of before. My site’s traffic has doubled so far and is breaking records every month since installing trinkets. This has been a very exciting improvement in both exposure and blog usability.

“My site’s traffic has doubled so far and is breaking records every month since installing trinkets.”

Elliott: Do you have a favorite Project Euler solution that you’d like to share and/or explain briefly?

Mike: I wish I had a more graphical solution to share as that is much more eye-catching that the typical printed results. I do plan on adding graphics to augment my collection but if I had to pick just one, then my solution to Problem 31 would win. It gets over 2000 visits per month and is a classic example of solving counting problems using dynamic programming. In some ways, trinkets have become online calculators for specialized problems where parameters can be changed, such as the ‘coins’ array in Problem 31, and view the results instantly. Here’s the trinket:

Mike Molony’s Project Euler Problem 31 solution. See Mike’s original post here.

Elliott: How did you first get into programming? And how did you pick Python as a language?
Mike: I started programming in the 1970s using Fortran II and assembly language in high school and soon realized the cycle of typing source on paper tape, compiling/linking and running only to find a syntax error was getting old quickly. So I discovered BASIC and fell in love with the instant response of interpreted languages. Years later I discovered Perl and migrated to Python which is simply one of the best languages to learn and develop with. Python offers a rich scope of programming models and can solve complex problems in a concise and easy-to-understand way.

“I fell in love with the instant response of interpreted languages”

Elliott: What advice do you have for teachers who are interested in using Project Euler in their classrooms?
Mike: The Project Euler problems start out very easy and gradually get more complicated. They teach simple numerical analysis, computer science and, indirectly, programming. As a problem set, they have enough for every skill level and programming language to keep things interesting. It’s a great way to introduce gamification in the problem solving arena by having badges and levels awarded for students’ performance.

Elliott: What’s next for you and your blog? Any other projects you’d like to share?
Mike: I have committed to publishing once a week. I have solved over 450 of the problems (originally in Perl) and pick one randomly to write about. I am currently developing a device that provides biometric identification using the dorsal hand vein pattern. It is algorithmically intensive and very rewarding to work on.

Elliott: Where can users find you if they have questions or suggestions for you?
Mike: My Twitter handle is @betaprojects

  • Dirk

    This kind of thing is exactly antithetical to the spirit of Project Euler. There is already a place to discuss solutions to the problems: in the forum which is accessible by the people who have solved the problems. Posting your own solutions destroys the challenge for everyone else and cheapens the accomplishment for the people who solved them legitimately, and publicizing it by writing a blog article about it compounds the problem. Please remove this blog article and each of your solutions.

    • Michael Molony

      DIrk, it is this very reason I publish my posts about solutions. Elitist such as yourself love to keep hidden knowledge and information from those whom may not have access to a solution and are frustrated by not being able to solve a problem.

      Your horribly misguided interpretation of ethics is to deny freedom of expression and support censorship. It supports and does not destroy the challenge because a deliberate and conscious effort on the part of the problem solver must be initiated to see the solution. They’re searching for it.

      Your propaganda is best served by a fascist regime trying to keep the populous blind and ignorant.

      • Dirk Durka

        The Project Euler FAQ itself says the following:

        “I learned so much solving problem XXX so is it okay to publish my solution elsewhere?

        It appears that you have answered your own question. There is nothing quite like that “Aha!” moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, however, that will not be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.”

        I didn’t make this up. This is the philosophy propounded by the creators of the problems that you are solving.

        This is not knowledge and information in the sense of cutting edge science, or accurate reporting on the activities of government, this is more similar to cheat codes for a video game, or giving a student the answers to a test in advance. This has nothing to do with censorship by a fascist regime, this is asking you politely to self-censor so as not to deny other people the experience that you were able to have. You are circumventing the mechanisms built alongside the problems that you find so valuable. If you are going to flaunt the problem creators’ intentions so blatantly, at least have the intellectual consistency to boycott the entire thing.

        The frustration that you cite is useful, it is what motivates people to learn the necessary methods to actually find a solution for themselves. It drives the learning process. I’ve searched for clarification on problems that were unclear, and instead found full solutions, depriving me of the opportunity to learn. Published solutions are a disservice to your readers, not a service.

        Two years after my very polite comment you respond with insults. How dare you call my request propaganda, and politicize this to self-righteously claim the moral high ground. If the effect of your freedom of expression is the vandalization of somebody’s works of art, maybe you should reconsider the value of that expression.