I really like maths, computer science and riddles. Naturally, I have been a big fan of projecteuler.net for a long time now. It is a website with hundreds of mathematical riddles of increasing difficulty. For every problem, you need a good combination of maths and programming, although some problems can be solved with pen and paper only.

I have even created projekteuler.de for crowdsourcing German translations of the problems. During the development of the website, I wanted to keep the number of problems as well as their titles and content up-to-date in order to allow early translation. In a different project (that will have its own blog post), I wanted to generate statistics on the Project Euler problems and the fastest solvers. In both cases, an API can help us programmatically get such data and process it further, as we don’t need to extract the data e.g. from HTML. In this post, I will describe the API available from Project Euler. It is mostly based on this forum post, but updated with my own experience as well.

Some endpoints have different behavior on whether or not the user is logged in. In such cases, the relevant cookie PHPSESSID has to be set, which describes a current user session on the website. You can find the cookie for a running session via your browser’s tools.

## Problem Overview#

The following URL gives a simple overview of all problems.

https://projecteuler.net/minimal=problems


The answer is a CSV with a header, and all entries are separated by ##. All times are in Unix time, i.e., the number of seconds since January 1, 1970.

ID##Description##Published##Updated##Solved By
1##Multiples of 3 or 5##1002301200##1627116278##967431
2##Even Fibonacci numbers##1003510800##1355693477##771402
3##Largest prime factor##1004724000##1355693477##554590
4##Largest palindrome product##1005933600##1355693477##490668
5##Smallest multiple##1007143200##1355693477##494034
...


If you are logged in, you can find an additional column on whether or not you have solved the problem.

ID##Description##Published##Updated##Solved By##Solve Status
1##Multiples of 3 or 5##1002301200##1627116278##967431##1
2##Even Fibonacci numbers##1003510800##1355693477##771402##1
3##Largest prime factor##1004724000##1355693477##554590##1
4##Largest palindrome product##1005933600##1355693477##490668##0
5##Smallest multiple##1007143200##1355693477##494034##0
...


In case a more standard CSV is what you want, you can call the following URL.

https://projecteuler.net/minimal=problems;csv


"ID","Description","Published","Updated","Solved By"
1,"Multiples of 3 or 5",1002301200,1627116278,967431
2,"Even Fibonacci numbers",1003510800,1355693477,771402
3,"Largest prime factor",1004724000,1355693477,554590
4,"Largest palindrome product",1005933600,1355693477,490668
5,"Smallest multiple",1007143200,1355693477,494034
...


"ID","Description","Published","Updated","Solved By","Solve Status"
1,"Multiples of 3 or 5",1002301200,1627116278,967431,1
2,"Even Fibonacci numbers",1003510800,1355693477,771402,1
3,"Largest prime factor",1004724000,1355693477,554590,1
4,"Largest palindrome product",1005933600,1355693477,490668,0
5,"Smallest multiple",1007143200,1355693477,494034,0
...


## Upcoming Problems#

In order to get information on upcoming problems, the following URL can be called.

https://projecteuler.net/minimal=new


It gives the release dates for upcoming problems in Unix time, with ## as separator.

776##1639281600
777##1639897200
778##1640512800
779##1641042000
780##1641657600


## Problem HTML#

The following URL provides the HTML content of a problem description. Note that this might include MathJax!

https://projecteuler.net/minimal=<id>


For example, calling https://projecteuler.net/minimal=1 will yield:

<p>
If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3, 5, 6 and 9. The sum of these multiples is 23.
</p>
<p>Find the sum of all the multiples of 3 or 5 below 1000.</p>


## News#

The following URL provides all news as an RSS feed, including information on upcoming problems.

https://projecteuler.net/rss2_euler.xml


The answer looks like this, with some entries removed for better readability:

<?xml version="1.0" encoding="utf-8"?>
<channel>
<title>Project Euler</title>
<description>A website dedicated to the fascinating world of mathematics and programming.</description>
<language>en</language>
<lastBuildDate>Mon, 06 Dec 2021 20:22:28 +0000</lastBuildDate>
<ttl>60</ttl>
<item>
<title>Problem 771</title>
<description>Release date: Sat, 06 Nov 2021 13:00:00 +0000</description>
</item>
<item>
<title>Server Move</title>
<description><![CDATA[ <p><p>During the weekend of Friday 24 September 2021, Project Euler is moving to a new server. As a result we have decided to suspend any problem release during that weekend.</p>

<p>The move will begin on Friday evening (Central European Time). During this time the current server will be taken offline to allow the database to be transferred. After the data has been moved it will be necessary to update the DNS settings. Once your local DNS server has been updated you should be automatically directed to the new server. However, it can take up to 24 hours for the new settings to propagate throughout the world and during this time you may encounter some instability, finding yourself being directed to the old and the new server.</p>

<p>It is hoped that the move happens without incident, but we kindly ask you to be patient during this time and apologise for the inconvenience that this may cause.</p></p> ]]>
(Friday 17 September 2021: Server Move)</description>
<pubDate>Fri, 17 Sep 2021 02:00:00 +0100</pubDate>
</item>
</channel>


## Profile#

If you want to get information on a user, you can call the following URL.

https://projecteuler.net/profile/<username>.txt


For example, calling https://projecteuler.net/profile/philipp94.txt gives information on my profile. In particular, it yields the username, country, programming language, number of solved problems, and level, as a CSV without header.

philipp94,Germany,Python,316,12


The same information is also available as XML, via this URL:

https://projecteuler.net/profile/<username>.xml


For my profile, this yields:

<?xml version="1.0"?>
<profile>
<country>Germany</country>
<language>Python</language>
<solved>316</solved>
<level>12</level>
</profile>


For some users, the information looks different. For example, the solved count of euler is replaced by the word Administrator.

One can use the following URL to get a nice profile banner.

https://projecteuler.net/profile/<username>.png


You can use this URL to put your banner into the signature of the Project Euler forum. For example, my banner looks like this:

## Solve History#

If you are logged in, you can retrieve a list of all problems you solved, including the date.

https://projecteuler.net/history


However, the answer is not very well-formatted, and it seems like no solve dates before sometime around 2012 or 2013 are available.

749: 03 Dec 21 (11:07)
452: 29 Nov 21 (22:56)
746: 29 Nov 21 (15:01)
358: 28 Nov 21 (22:06)
773: 20 Nov 21 (21:05)
587: 18 Nov 21 (22:19)
772: 17 Nov 21 (15:45)
755: 18 Apr 21 (13:39)
...

065: 30 Jul 13 (15:13)
114: 15 Feb 13 (11:49)
117: 10 Feb 13 (17:00)
116: 10 Feb 13 (13:45)
001: No date available
002: No date available
003: No date available
...


## My Wish List#

Finally, I want to provide a wish list on some additional information that I would love to see available as an API.

• Fastest solvers: The list of fastest solvers per problem is currently only available for logged in users, and only as HTML (i.e., https://projecteuler.net/fastest=773. Thus, parsing the HTML for further analysis is rather difficult. Having this data available via an API would be very helpful.
• Problem difficulty: It would be very helpful to have the estimated problem difficulty as part of the problem API.
• Problem tags: Similarly, maybe the problem tags can become part of the API.

## Closing Thoughts#

Did I miss anything? Are there any other features of the API you would like to see? Let me know!