Computer Science Canada ProjectEuler Problem 15 |
Author: | QuantumPhysics [ Sun Dec 23, 2012 5:10 am ] |
Post subject: | ProjectEuler Problem 15 |
I was reading the forums of question 15, and apparently someone solved it with a language called 'R'. I was amazed that the code for answering the question was as simple as: choose(40,20) |
Author: | [Gandalf] [ Sun Dec 23, 2012 5:59 am ] |
Post subject: | RE:ProjectEuler Problem 15 |
This is nothing specific to R, in fact you can do this using Google: https://www.google.ca/#hl=en&q=40+choose+20&oq=40+choose+20 http://en.wikipedia.org/wiki/Binomial_coefficient |
Author: | A.J [ Tue Dec 25, 2012 3:32 am ] |
Post subject: | RE:ProjectEuler Problem 15 |
The idea comes from the fact that the number of paths from (0, 0) to (n, m) moving only up and right is '(n + m) choose n' or equivalently '(n + m) choose m'. |
Author: | QuantumPhysics [ Tue Dec 25, 2012 5:26 am ] |
Post subject: | RE:ProjectEuler Problem 15 |
Oohhh, well I didn't think it like that. Thanks, before this I was very confused. Mainly because my solution was so much more difficult, I was just surprised at the time I could have saved. |
Author: | QuantumPhysics [ Tue Dec 25, 2012 5:51 am ] |
Post subject: | RE:ProjectEuler Problem 15 |
I am viewing other peoples answers for question 354 - Someone completed it in Coffee? Never heard of that language. Its apparently a scripting language. [edit]snip[/edit] That was his source code. Pretty easy. Mine was so much more difficult. Took some thought and well -> Mine is always difficult I can never find the easy way out. |
Author: | Panphobia [ Tue Dec 25, 2012 2:48 pm ] |
Post subject: | RE:ProjectEuler Problem 15 |
in data management I think we were taught to use the pascals triangle for this type of question, like flip the square to be a diamond and you can label each point with how the pascals triangle is set up like a point is equal to the sum of the two points above it, and that would give you the amount of paths to a certain point |
Author: | Insectoid [ Wed Dec 26, 2012 11:34 am ] |
Post subject: | RE:ProjectEuler Problem 15 |
Since Pascal's Triangle is a big table of N choose R, that makes sense. |
Author: | A.J [ Wed Dec 26, 2012 5:35 pm ] |
Post subject: | RE:ProjectEuler Problem 15 |
I believe that code was referring to PE354. You shouldn't post code from the solution thread here. For some reason I am not able to edit your post. Could another mod remove the code please? |
Author: | Tony [ Thu Dec 27, 2012 3:30 pm ] |
Post subject: | RE:ProjectEuler Problem 15 |
Removed posted code. P.S. You might be thinking of CoffeeScript. In which case it's a hip new syntax to JavaScript. |