Skip to content
euler project solutions in python, c++, c#, java, php, ruby
Python C# Java C++ PHP Ruby Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
common_m
common_py
euler001
euler002
euler003
euler004
euler005
euler006
euler007
euler008
euler009
euler010
euler011
euler012
euler013
euler014
euler015
euler016
euler017
euler018
euler019
euler020
euler021
euler022
euler023
euler024
euler025
euler026
euler027
euler028
euler029
euler030
euler031
euler032
euler033
euler034
euler035
euler036
euler037
euler038
euler039
euler040
euler041
euler042
euler043
euler044
euler047
euler048
euler049
euler050
euler051
euler052
euler053
euler054
euler055
euler056
euler057
euler058
euler059
euler063
euler067
euler069
euler079
euler092
euler096
euler097
euler099
euler206
.gitignore
README.md

README.md

Origin

Before the winter of 2013, I ran in the website of Euler Project and was amazed at the idea of solving common mathematical problems (often problems related to numbers, permutation and combination). I am not particularlly interesting in mathematics, but I spent weeks on it because the joy of solving problems was so great.

To make programming with mathematics less boring, I tried to utilize different programming languages: c++, c#; java; python, php, ruby. Sometimes, I solved the same problem with more than one language, or more with more than one way.

How to run

c++

http://stackoverflow.com/questions/221185/how-to-run-c-c-in-a-unix-console-mac-terminal

c#

on windows cli, run:

$csc solution.cs

you will get a solution.exe. Then, run

$solution

php

on your cli, run:

$php solution.php

java

$javac solution.java

$java solution

ruby

$ruby solution.rb

python

$python solution.py

Performance of different languages

Try to solve the same mathematical problems in different programming languages, you can see the differences of execution are enormous.

For example, it became obvious to me that some languages specializing in web development, such as php, ruby, are slower in executing CPU and memory intensive programs, than other more general-purpose languages (c++,c#, python,java). Sometimes, it is simply not possible to get a result in a reasonable time scope.

You can’t perform that action at this time.