Source

euler /

Filename Size Date modified Message
euler2
84 B
1.4 KB
2.4 KB
0 B
19.3 KB
2.0 KB
1.6 KB
2.0 KB

euler is a command line tool for running and submitting Project Euler problems. Go here to see what it looks like when you submit a successful problem: https://skitch.com/kburke/fmkf3/1-bash-2-1

Get Started

I've submitted it to Macports, but in the meantime you need to do a little bit of work to get started. You need the jp2a, ImageMagick and BeautifulSoup libraries installed.

$ sudo port install jp2a ImageMagick py27-beautifulsoup

Then grab the euler script (just one file) and place it somewhere in your PATH.

Usage

euler requires two pieces of information from you: the number of the problem you are trying to solve, and your proposed solution. You can do this in one of a few ways:

  • Submit a problem number and a problem file.

    euler will run the problem file and treat the first line of output as the solution.

    $ euler -p 22 problem22.py
    $ euler -p 17 myjavasolution.java
    
  • Submit a problem number and a solution.

    Use the -s or --solution flag.

    $ euler -p 14 -s 24289
    $ euler --problem 11 --solution 242113
    
  • Pipe the solution to Project Euler.

    Here you go, fancy pants:

    $ perl problem240solution.pl | euler -p 240
    

    This assumes that your file will output the solution as the first argument to stdout.

Username Configuration

You can also save your username and password in a file named .eulerrc in your home directory (~/.eulerrc or /Users/yourusername/.eulerrc). The format is:

[login]
username = myusername
password = mypassword

Note that there are no quotes around your username or password.

Supported Languages

Here are the languages currently supported by euler:

C
C++
Haskell
Java
Python
Ruby

If your language isn't supported, you can pipe a solution in via stdin:

$ sml problem4.sml | euler -p 4

Or specify your solution as another argument on the command line:

$ euler -p 4 -s 99032

Pull requests to add new languages are also welcome.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.