Pick a Language

In this forum members can discuss topics about specific programming languages.
Post Reply
carpediemevive
Posts: 1
Joined: Thu Jun 02, 2011 7:27 pm

Pick a Language

Post by carpediemevive » Thu Jun 02, 2011 7:30 pm

Brand new to the site and excited about getting started, but I'm wondering if for any of the coding pieces I should try out a new language, or if you have found thinking about this problem with a particular language to be easier. I was considering going with a functional language since I'm fairly weak with those right now. Any language you think makes these problems more fun?

User avatar
rayfil
Administrator
Posts: 1402
Joined: Sun Mar 26, 2006 4:30 am
Location: Ontario, Canada
Contact:

Re: Pick a Language

Post by rayfil » Fri Jun 03, 2011 12:03 am

How about assembly? :shock: :lol: :twisted:
When you assume something, you risk being wrong half the time.

davidFashion
Posts: 14
Joined: Fri Mar 04, 2011 10:53 pm

Re: Pick a Language

Post by davidFashion » Sat Jun 04, 2011 1:01 am

I have programmed the solutions to the problems on this site is Java. This is the language with which I have the most knowledge.

Many (most, nearly all) of these problems require a significant amount of knowledge beyond what you know about your specific computer language. While solving these problems, you will often need to make a major and numerous changes to your specific solution. Many times, complex algorithms are involved. It is my opinion that these challenges are enough.

If you are trying to learn a new programming language, there usually are many online tutorials available to teach you the language. Use these sites to learn a language.

If you want to solve complex programming challenges, then this is the site for you. After you solve the problem, learn from others about other potential solutions. This will not improve your knowledge about a programming language, but will significantly improve your programming skills. For many problems, I will write more code after solving the problem. Many clever and useful insights and algorithms are presented.

Image

Spura
Posts: 8
Joined: Mon May 16, 2011 3:49 pm

Re: Pick a Language

Post by Spura » Sun Jun 05, 2011 11:58 pm

I disagrre with the above. These are not complex programming challenges. These are mathematical challenges (numerical methods of calculating something). The actual programming when you figure out a solution is quite simple most of the time. The hardest part is researching the numerical theory, number properties etc that the problem requires. A programming challenge is handling change propagation in distributed multi tier business applications.

davidFashion
Posts: 14
Joined: Fri Mar 04, 2011 10:53 pm

Re: Pick a Language

Post by davidFashion » Mon Jun 06, 2011 2:28 am

Spura wrote:A programming challenge is handling change propagation in distributed multi tier business applications.
Each time I created an automated migrated process for a large scale production application had it's own unique challenges. But ultimately, the business rules that govern such a system have less algorithmic complexity than a Project Euler problem. If you compare the overall complexity of a automated migrated process for a large scale production application to one Project Euler problem, then the change propagation is more complex. But, broken down to the individual requirements and business rules, then the Project Euler problem is usually more complex (especially those after the first 100 problems).
Spura wrote:The actual programming when you figure out a solution is quite simple most of the time. The hardest part is researching the numerical theory, number properties etc that the problem requires.
Sure, once you figure out the solution for some problems the programming can be simple. But I can say the same statement for any problem that that has been solved. Unfortunately, you cannot separate the effort from the solution. Without the effort necessary to reach a solution, then there is no solution.

In any case, there are many problems that have a relatively complex algorithmic solution. These are complex programming challenges that stand on their own.

Image

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 2:31 am

Re: Pick a Language

Post by TripleM » Mon Jun 06, 2011 8:40 am

I have to agree with Spura. I would call these algorithmic challenges, not programming challenges. There are two steps to getting a final answer for a problem:

1) Thinking of the correct algorithm
2) Implementing it in the programming language of your choice.

Sure, 2 is not always easy, but coming up with 1 is far and away the main part of each problem. In fact, if I showed you one of these problems, and you told me in words an efficient way to solve it, I would say you had solved the problem. Having a deep knowledge of a programming language is not necessary.

Spura
Posts: 8
Joined: Mon May 16, 2011 3:49 pm

Re: Pick a Language

Post by Spura » Wed Jun 08, 2011 3:24 pm

I don't find converting algorythms into code, that is converting calculations or graph transformations or graph traversals into code (and this is what almost all problems here come down to) at all challenging. You might argue that the algorythm part IS the programming. Even so, in regard to OP's question "is being new to the language a problem", I would say no, as algorythms are not language specific and the actual coding is IMO trivial. Learning a new language is about learning idiomatic ways of coding in a language and paradigms (if you try to learn C# after working C you need to absorb the whole OOP paradigm, similar if you switch from Java to Clojure).

scand1sk
Posts: 1
Joined: Tue Jun 14, 2011 3:23 pm

Re: Pick a Language

Post by scand1sk » Tue Jun 14, 2011 3:26 pm

I primarily used Project Euler to improve my functional language programming skills (i.e., Scala). I felt very relieving to find an almost natural-language, optimal algorithm in one line for some problems.

suitti
Posts: 12
Joined: Fri Jul 08, 2011 7:13 pm

Re: Pick a Language

Post by suitti » Tue Aug 16, 2011 8:43 pm

I recently spent free time over about two years with the LISP family language 'Scheme'. I had an implementation on a Palm Pilot, and on Linux (guile). Both implementations were quite slow compared to C. The Palm is incredibly portable, and i could spend a few minutes on some idea from time to time. Scheme lends itself to functional programming.

However, so does C. For example, modern gcc (a free compiler) does tail recursion optimization. For some algorithms, it allows unlimited recursion depth. I don't think of C as a particularly functionally-oriented language. Most people don't. But at the moment, i don't see any real reason to avoid functional programming with it.

I find the LISP family of languages very difficult to write (design the needed structure), deal with data structures (they all seem to have to be directed graph trees, when all i want is an array), and read. So, i looked around for a handy Forth like language. And, it turns out that i have a 1986 vintage HP-28C calculator. It's programming language is called RPL. The HP-28C's biggest limitation is that it only has 2 KB of RAM, which limits it for many ProjectEuler problems. I also ignore the 1 minute rule with this beast. If this machine can complete a program within the life span of the batteries (there's no A/C adaptor), then it will finish in a reasonable amount of time on any modern machine. I've used it for a few of the solutions.

In one of the papers on LISP, from one of the LISP gods, there was a complaint that a programmer had implemented a matrix multiply. The code was tight, elegant, but incredibly inefficient. The exact complaint was something like, "no C programmer would ever make such a mistake". I had written a matrix multiply nearly identical to the example. My complaint is that i still haven't found either an explanation for why it's so slow, nor what an efficient implementation might look like. It's often important to know not only what the machine is going to do, but how it's going to do it. C gives us that. Many languages like Perl, LISP, and so on, do not. Having written in various assemblers, i find it easiest to write in C.

oliverue
Posts: 6
Joined: Wed May 25, 2011 10:16 am

Re: Pick a Language

Post by oliverue » Wed Aug 17, 2011 8:30 pm

Obviously, which language to pick depends on one's experience and what you're after.

If you're a newbie, I think Python is great.
I would absolutely steer away from C or C++ because of the learning curve.
Java is quite low-level for PE problems *and* it's not a speed demon, so I wouldn't consider it a good choice.
I really like JavaScript but can't recommend naked JavaScript for PE due to slow speed and hard-to-find math code.

If you're not a newbie, you probably know exactly what you're doing and what language will suit you.

Math environments offer a very suitable built-in function set for these problems, which allows you to focus on the math, and not spend time with rather tedious implementation work. (On the other hand, maybe you *want* to learn how to write a prime number sieve, and not just use one.)

If you have access to Mathematica, Maple, Sage, you will probably not want to use anything else. It's not per chance that Mathematica ranks as #1 language.

I continue to be very impressed with the terseness of J and K, but I find it a bit too alien/unreadable, even after having spent an hour with the J tutorial and having some tolerance for weird languages.

If you enjoy solving PE problems on the go, there's not much choice.
I'm developing an iOS calculator app and am solving all my PE problems in RPL+ and JavaScript (w/ math lib). RPL is a bit yesteryear but likable (I think) and comes with lots of built-in math functions, that permit terse solution (often terser than Mathematica, and far more readable than J). Google for "Project Euler study guide" if you'd like to see some code. ND0 is a free app to pick up and allows you to develop PE solutions on the go. Half of the problems I solved so far have solutions that run in <1s, on a device that's ~15x slower than a desktop machine.

To me, almost the most fun part of PE is looking at the implementations in all the languages people are using in the solution threads. Trying out languages is fun, and quite a few people seem to have taken solving PE problems as an opportunity to learn a new language.

lrhehe
Posts: 4
Joined: Sun Dec 11, 2011 1:10 pm

Re: Pick a Language

Post by lrhehe » Sun Dec 11, 2011 1:26 pm

I like python, too

You can try as many as possible and choose the one you like.
It doesn't need much time.

User avatar
dapostolopoylos
Posts: 1
Joined: Tue Oct 22, 2013 12:15 pm
Location: Athens - Greece
Contact:

Re: Pick a Language

Post by dapostolopoylos » Tue Oct 22, 2013 12:26 pm

I have some experience in Python but i chose to solve the problems in projecteuler.net with C#...
The reason is that i try to get familiar with C# so projecteuler.net is a good place to sharpen my skills...
I believe that the right language is the one you feel comfortable with and gets your job done... :)
Image

woofy31
Posts: 2
Joined: Fri Dec 20, 2013 11:36 am

Re: Pick a Language

Post by woofy31 » Fri Dec 20, 2013 11:44 am

I would definitely recommend Python - it's a language designed for programming with speed, it's fast, and it also puts the fun back in code! :)

I have learned several languages before this, like Pascal, C++, Java, JavaScript, then C#, and I fell in love with C# in the end. But after a while I started thinking: isn't there an easier way to do things while writing less code? Because C# tends to become really lengthy.. and so I've found Python, which put the fun back into coding :)

hsmart
Posts: 1
Joined: Sat Sep 24, 2011 5:54 am
Contact:

Re: Pick a Language

Post by hsmart » Thu Jul 03, 2014 5:15 am

I have had the most success solving these problems with Python, with C++ coming in second place, third Java.
Since I am an iOS developer I use Xcode for the C++. I use IDLE for Python. I did some in Eclipse - Java and Python both.
I actually tried to do some problems in Objective-C, but it was cumbersome to say the least.
I will probably get flamed for being an Apple person, but I think I am going to try some solutions in Swift now. Should be fun.

I applaud those of you who use something like Scheme or Racket. I have a hard time turning my thinking sideways to come up with pure functional algorithms.
He that breaks a thing
to find out what it is
has left the path of wisdom
Gandalf

csnate
Posts: 1
Joined: Tue Jul 08, 2014 2:53 pm

Re: Pick a Language

Post by csnate » Tue Jul 08, 2014 3:00 pm

Project Euler problems rely more on clever algorithms. I too use Project Euler to sharpen my functional programming skills. In other words, when solving the problems, I try to think functionally and the algorithms that I come up with could be implemented in almost any language. I use Haskell to implement the solutions personally since it forces you to think in terms of the paradigm. Of course, there are ways to do things iteratively in Haskell but its not recommended.

Agrentum
Posts: 10
Joined: Mon May 05, 2014 11:44 pm

Re: Pick a Language

Post by Agrentum » Fri Jul 11, 2014 2:05 am

I'm going to stray a bit from advice here, and propose to actually start learning with C. Here is why:

C allows you to write insanely efficient code. It is not as easy as Python or Ruby to start, but it will throw you into deep water. At first you might struggle with some quite rudimentary things but if are capable of passing it, you will be able to learn almost any language. Additional feature is pretty small set of functions. To a point, programming in C is like building with LEGO. Alone, your blocks are not that impressive. But because you are not distracted by vast libraries of highly specific functions you will learn even more by making them for yourself. It is a long journey, and even after 5+ years you will learn new things about the basics, but I can surely say it is worth the effort. I would probably not use C if I have started learning from Python, because it would simply look to me as a clunky mess.

Another language that is great to start with is Scheme or Common Lisp (I do feel some regrets that I have started with C instead). Actual language is not that important, there are many flavours of both (Chicken Scheme, Racket, Emacs Lisp to name some) because they mostly differ in syntax and a little in paradigm. Learning one of them is transferable to nearly all of them (I'm not an expert though, if this is false in any way I would love to know about it and retract this statement). What it offers is flexible paradigm that is almost the same as writing your thoughts directly. You are not distracted by types, memory allocation and other things that make C hard for most people. You design an algorithm and simply apply syntax.

To learn C I would recommend The C Programming Language.

To learn Common Lisp I would recommend Common Lisp: A Gentle Introduction to Symbolic Computation.

To learn Scheme I would recommend Structure and Interpretation of Computer Programs. There are also videos from lectures provided by MIT OCW on youtube. Damn, I would recommend this course just because of great lecturer ;).
Image - self-demoted from 357, I want to return to this score by solving everything in C/C++.

giniajim
Posts: 1
Joined: Tue Oct 20, 2015 12:14 am

Re: Pick a Language

Post by giniajim » Tue Oct 20, 2015 12:49 am

I've just started with PE and have worked the first four problems. My "program" of choice was a spreadsheet (I use Open Office). Reason: it's available and I'm somewhat comfortable with using it. But it's pretty awkward imho for solving the PE problems. The 4th problem I solved with a 900x900 matrix with a 262 character algorithm in each cell. Even then, I had to use a little "Kentucky Windage" to home in on the right answer. (I would guess that even with a spreadsheet there are more efficient ways to solve #4; I haven't looked at others' solutions).
I'd like to try a computer program. I've never been a programmer per se, but have taken a class in Fortran and another in Pascal (*many* years ago) and enjoyed them. Back in the punch card days. And before that, I had some exposure to JOSS.
From what I've read here, it looks like Python might be a place for me to start

User avatar
stephj
Posts: 5
Joined: Sun Apr 13, 2014 5:22 pm
Location: Lancashire, UK

Re: Pick a Language

Post by stephj » Tue Oct 27, 2015 11:21 am

I normally code in C/C++, sometimes in C#, but quite often I start with a spreadsheet to test whether a particular method works as expected before even writing a single line of code. In developing the spreadsheet, I have then ‘accidentally’ run into the correct answer several times.

If I’m on the right track then I code it in one of the above languages, only because I am familiar with them. From this point most languages will do.
Image

Dravidian
Posts: 3
Joined: Sun May 01, 2016 10:16 am

Post by Dravidian » Sun May 01, 2016 10:36 am

Hey, Guys...i am totally new to the site , am an electrical undergrad. but always had a nag for math apt. and programming.I use mac and thus i use Xcode also swift, i do know c++/c. and these are the only language that i am little fluent in.
My Question is what language do we need to use to effectively solve the problems and some of the questions i tried were taking a hell lot a time on Playground (Some even hanged).Is it extremely necessary to learn a language like Java or Assembly to solve these problems or the solution the the PE problems is solely based on algorithms that individual develop to solve that problem?I was also wondering the aspects of ProjectEuler Problems, given that i love maths and programming, if i do this will i be able to mention my awards, ranks etc. in my resume? If not what are the up's of solving ProjectEuler setting aside personal Mathematical and Programming Aspect of it..?

I know its a lot to ask for a Newbie, was just wondering.... :D

User avatar
stephj
Posts: 5
Joined: Sun Apr 13, 2014 5:22 pm
Location: Lancashire, UK

Re: Pick a Language

Post by stephj » Mon May 16, 2016 11:47 am

From the statistics button on PE once you are logged in, select the Languages box and press enter. There are some ninety odd languages that users have identified that they use, some are more obscure than others, but those in the top 20 cover the majority.

If your programs are running for a week, then you have missed the trick, which might even be as simple as starting from the other end of the problem and working back.

There is no ‘best’ language to use, most languages will do, some are better at some sorts of problems than others. I tend to use C/C++ and C#, but have recently had a rerun at some of the early problems in Python, and was quite surprised at how few lines of Python code you need to get the job done.
Image

Post Reply