If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
http://projecteuler.net/problem=1
There are many different solutions to any given problem, some more elegant than others. I have seen the solution to this code in as little as 1 line of javascript code. There exist many ways of arriving at the solution, arranging the steps and order of operations, cleanliness of code, readability, simplicity and hundreds of other qualitative variables that affect the code.
My solution to the code:
Project Euler Problem 1 Solution
Made using: Khan Academy Computer Science.
Creating the above program was my first return to programming since college. From this project I learned:
- Khan Academy tutorials are exceptional, and the code editing tool is great with the documentation for examples on coding, proper usage, and much more.
- What seems the most simple and straightforward in the beginning of writing a program will become the biggest challenge of the entire project.
- A problem may not be solved the way you first anticipate it, and that the way you are trying to solve a problem might be causing new and different problems. Try to simplify and accomplish one step at a time.