I absolutely love project Euler. The math on the harder problems is way over my head but it is still my go-to site whenever I want to learn a new language. By the time you've done a bunch of them you'll be more than underway in understanding the territory and in a much better position to understand tutorials (which inevitably are written by experts in the language and usually make a ton of assumptions).
Alternating between project Euler, a book (or two), back to project Euler for a bit is a very fast school, and you determine how fast you can pace yourself.
I'm hardly in the position to be telling you how you learn a language best, but I always felt programming type puzzles of the oj.leetcode.com variety were better for getting me to learn a programming language, where as projecteuler.net was better at developing mathematical/algorithmic reasoning skills. A non-trivial amount of the early puzzles are do-able by hand.
One of my favorite parts of Project Euler was getting something where the math seemed beyond me, but I could use a tool like Google to get further.
Not to cheat using Google, but to discover the name of the branch of mathematics I had no clue about, and then to learn enough to keep going.
I still remember the afternoon I spent doing chromatic polynomials by hand, each graph I drew having more mental exclamations on the end, because I was goddamn getting it.
For me, the lift from earning a right answer is palpable.
Yes, I do exactly the same thing! The first 20 problems in particular are excellent for learning a new language. It covers basic math, list operations, file IO, string parsing; in other words all the basics in learning a new language. Plus several of the problems are strung together and encourage you to build up a structured library of tools to help you solve any number of problems.
I'm trying to make it a guide to the language, and programming in general, for true beginners. The very first post of actual coding (after installing, command line basics, and compiling/running with cargo) is a walk through of the first PE problem.
I know how you feel about most beginners guides not actually being suited for beginners. Since I'm a beginner, I'm hoping I'll be able to write one.
Feel free to check it out, and constructive criticism is encouraged!
> it is still my go-to site whenever I want to learn a new language
The great thing about Project Euler for this is that the correct answer isn't a piece of code or an algorithm in some language, but just a number.
Project Euler does not really care how that number was derived. Using a mathematical formula, plain pencil and paper, a program in some language, or cheating via Google-fu? Euler doesn't care.
Because of this, it is very inviting to code a solution in a different language: 1) to learn that language, 2) to use a concept of the language with a better fit with the problem, 3) to see which language yields the quickest answer, measured in development time or actual run time.
The drawback of Project Euler is that it's quite addictive.
Unless you're switching from e.g. Java to e.g. Prolog or Erlang (or Haskell...), is it really useful for learning a new language? I mean, when learning a new language, the basic syntax is the easiest part anyway, but the ecosystem/batteries/best_practices is where the main bottleneck is. And I have an impression that Project Euler problems will help you only with the very basics of the language.
"Saturday 31st of January Project Euler will reach a major milestone with the publication of our 500th problem. To celebrate this the team has composed a special problem in which the number 500 occurs repeatedly. In addition we're going to publish an ordinary problem simultaneously as problem 501. Both problems are published at 13:00 London time.
We invite all members to participate in our problem solving party. As celebrator of this jubilee we're allowed to ask the participants for a present. Well, here's our wish: please don't share any information about our party and the dishes we're serving you outside the fora dedicated to our dishes after your meal. This to allow those that are late to the party to consume our dishes undisturbed by premature revelations about what we are serving."
Rosalind is a great way to pick up some bio along with your algorithms.
The instructors also created a course on Coursera called "Bioinformatics Algorithms" that I highly recommend. It's basically an ordered set of rosalind problems but accompanied by a textbook and lectures. It was one of the most interesting things I did last year.
If you're interesting in the birth, inspiration and pedagogy behind Project Euler, I recommend this article [1].
And it's an effective teacher because those problems are arranged like the programs in the ORIC-1's manual, in what Hughes calls an "inductive chain":
The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem. So the determined participant will slowly but surely work his/her way through every problem.
After you solve a problem Project Euler lets you browse through a giant list of solutions by those who have gone before. It's really fun to see and compare all the different approaches.
If I could do one thing to augment the project I would make it possible to filter previous solutions by language and/or author.
For example, if I'm learning rust, I would love to see all the rust solutions right there together.
This is a nice little problem, I had fun solving it.
For those of us who are familiar with TopCoder, CodeForces or, perhaps, ACM ICPC, this should be daily bread and butter on prime numbers and data structures :)
Edit: hah, looking at the problems discussion board I took a very bruteforce approach, other people solved utilizing math, I used priority_queue for no particular reason :)
I was only recently introduced to Project Euler but already I'm addicted. I've got a folder where I've named each solution as pXXX.ext and try solving the problems in multiple different languages. I refuse to move on to a new problem until I've solved the previous one (I don't solve every problem in multiple languages. Instead I've been using it to learn/play with languages here and there I don't really know).
Another way to go about all this is to sort them by how many people solved them and go from easiest to most difficult. This way you maximize your learning/time!
This is a better solution, since 2x2 is smaller than the 500500th prime.
If we want continue doubling factor count by multiplying 2s, we will need to multiply by 2x2x2x2 next, and 2^8 after, which becomes inefficient quickly.
Instead, why not use 3? Multiplying (2x3x5x...x500499th prime) by (3 x 3) also doubles the factor count.
So at this point, we think about doubling factor count and the ways we can do it. Out options are
<1>. Multiply by a prime that we have never used so far
<2>. Multiply by an existing prime k + 1 times, where k is the number of times it has been used
We repeat this 500500 times, using rule <1> and <2> (which can be generalized to one rule) and the result is the final answer.
For 16 factors the number works out to be 120 (just like the example!). For numbers shown in the questions, sieving the prime takes some time, I also found it helpful to use a binary heap for speeding up finding the next smallest factors.
[+] [-] jacquesm|11 years ago|reply
Alternating between project Euler, a book (or two), back to project Euler for a bit is a very fast school, and you determine how fast you can pace yourself.
[+] [-] trentmb|11 years ago|reply
Anyone else feel similarly?
[+] [-] ipsin|11 years ago|reply
Not to cheat using Google, but to discover the name of the branch of mathematics I had no clue about, and then to learn enough to keep going.
I still remember the afternoon I spent doing chromatic polynomials by hand, each graph I drew having more mental exclamations on the end, because I was goddamn getting it.
For me, the lift from earning a right answer is palpable.
[+] [-] acadien|11 years ago|reply
[+] [-] Bsharp|11 years ago|reply
I'm currently trying to learn Rust, and since it's so new everything is geared towards people with experience. So I started Rust For Beginners:
http://www.rustforbeginners.com
I'm trying to make it a guide to the language, and programming in general, for true beginners. The very first post of actual coding (after installing, command line basics, and compiling/running with cargo) is a walk through of the first PE problem.
I know how you feel about most beginners guides not actually being suited for beginners. Since I'm a beginner, I'm hoping I'll be able to write one.
Feel free to check it out, and constructive criticism is encouraged!
[+] [-] unknown|11 years ago|reply
[deleted]
[+] [-] jschulenklopper|11 years ago|reply
The great thing about Project Euler for this is that the correct answer isn't a piece of code or an algorithm in some language, but just a number.
Project Euler does not really care how that number was derived. Using a mathematical formula, plain pencil and paper, a program in some language, or cheating via Google-fu? Euler doesn't care.
Because of this, it is very inviting to code a solution in a different language: 1) to learn that language, 2) to use a concept of the language with a better fit with the problem, 3) to see which language yields the quickest answer, measured in development time or actual run time.
The drawback of Project Euler is that it's quite addictive.
[+] [-] zura|11 years ago|reply
[+] [-] platz|11 years ago|reply
[+] [-] bhaumik|11 years ago|reply
We invite all members to participate in our problem solving party. As celebrator of this jubilee we're allowed to ask the participants for a present. Well, here's our wish: please don't share any information about our party and the dishes we're serving you outside the fora dedicated to our dishes after your meal. This to allow those that are late to the party to consume our dishes undisturbed by premature revelations about what we are serving."
https://projecteuler.net/news
[+] [-] kyberias|11 years ago|reply
Also suitable for learning new languages (and bioinformatics).
The implementation of the site is awesome.
[+] [-] dhbradshaw|11 years ago|reply
The instructors also created a course on Coursera called "Bioinformatics Algorithms" that I highly recommend. It's basically an ordered set of rosalind problems but accompanied by a textbook and lectures. It was one of the most interesting things I did last year.
[+] [-] bhaumik|11 years ago|reply
And it's an effective teacher because those problems are arranged like the programs in the ORIC-1's manual, in what Hughes calls an "inductive chain":
The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem. So the determined participant will slowly but surely work his/her way through every problem.
[1]http://www.theatlantic.com/technology/print/2011/06/how-i-fa...
[+] [-] dhbradshaw|11 years ago|reply
If I could do one thing to augment the project I would make it possible to filter previous solutions by language and/or author.
For example, if I'm learning rust, I would love to see all the rust solutions right there together.
[+] [-] ipsin|11 years ago|reply
If you've never tried Project Euler, it's a great way to learn new mathematical concepts, sequences, dynamic programming and other algorithms.
https://projecteuler.net/problem=368 was one of my favorites, because it involved turning an algorithm described in a paper into code.
I don't consider this a spoiler for problem #500, but if you're counting the number of divisors, you'll need this function: http://oeis.org/wiki/Number_of_divisors_function#Formulae_fo...
As an example, 120 = 2^3 * 3^1 * 5^1
number of divisors of 120 => (3+1)(1+1)(1+1)
Even if you don't solve it, exploring the problem is a fun afternoon for a person with a computer.
[+] [-] sdenton4|11 years ago|reply
[+] [-] unknown|11 years ago|reply
[deleted]
[+] [-] florianletsch|11 years ago|reply
Any chance you guys know of a similar project for Computer Vision or general AI topics?
[+] [-] fela|11 years ago|reply
[+] [-] dman|11 years ago|reply
[+] [-] imslavko|11 years ago|reply
For those of us who are familiar with TopCoder, CodeForces or, perhaps, ACM ICPC, this should be daily bread and butter on prime numbers and data structures :)
Here is my solution if you are curious: https://gist.github.com/Slava/74276f5b7889a1d68a71 - computes the result in 400ms
Edit: hah, looking at the problems discussion board I took a very bruteforce approach, other people solved utilizing math, I used priority_queue for no particular reason :)
[+] [-] joshstrange|11 years ago|reply
Congrats to Project Euler on their 500th problem!
[+] [-] vlasev|11 years ago|reply
[+] [-] jacquesm|11 years ago|reply
[+] [-] goalieca|11 years ago|reply
[+] [-] RobertKing|11 years ago|reply
[+] [-] unknown|11 years ago|reply
[deleted]
[+] [-] sargun|11 years ago|reply
[+] [-] fishtastic|11 years ago|reply
--------- MAJOR SPOILERS ---------
Let's multiply unique prime numbers and count their factors.
Notice that each time you add a new prime number, the factor count doublesi.e. 2x3x5x...x500500th prime will have 2^500500 factors
The 500500th prime is 7376507 (thanks to wolframalpha), and it's not very big.
We can easily get the product of the above with 500500 multiplications while modding result of each step by 500500507 to get an answer.
Except that the product of first 500500 primes isn't the smallest number containing 2^500500 factors. This can be made smaller.
Observe that
has This is because with the extra 2 we added, it produces additional factors with existing factors that are a multiples of 2.Continuing with this, we see that
has This is a better solution, since 2x2 is smaller than the 500500th prime.If we want continue doubling factor count by multiplying 2s, we will need to multiply by 2x2x2x2 next, and 2^8 after, which becomes inefficient quickly. Instead, why not use 3? Multiplying (2x3x5x...x500499th prime) by (3 x 3) also doubles the factor count.
So at this point, we think about doubling factor count and the ways we can do it. Out options are
<1>. Multiply by a prime that we have never used so far
<2>. Multiply by an existing prime k + 1 times, where k is the number of times it has been used
We repeat this 500500 times, using rule <1> and <2> (which can be generalized to one rule) and the result is the final answer.
For 16 factors the number works out to be 120 (just like the example!). For numbers shown in the questions, sieving the prime takes some time, I also found it helpful to use a binary heap for speeding up finding the next smallest factors.[+] [-] thaumasiotes|11 years ago|reply