Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ProjectEuler Problem 15
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
QuantumPhysics




PostPosted: 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)
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: 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
A.J




PostPosted: 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'.
QuantumPhysics




PostPosted: 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.
QuantumPhysics




PostPosted: 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 Sad I can never find the easy way out.
Panphobia




PostPosted: 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
Insectoid




PostPosted: 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.
A.J




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: