So, here’s my take on the next Project Euler problem.
Problem 2 is indicated as follows:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
The first we can try is an obvious solution – try to go over every number in the Fibonacci sequence, check if it’s even valued, and add it to the accumulator if it is. Continue reading “Project Euler – Problem 2”
So, as I mentioned earlier, I will be posting solutions to Project Euler problems.
Problem 1 is indicated as follows:
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.
The first thing we can try is a brute force solution. Continue reading “Project Euler – Problem 1”
Some time ago I stumbled upon a very interesting project – http://projecteuler.net. As is stated on the projects page “Project Euler is a series of challenging mathematical/computer programming problems.” These problems are a great way to exercise the mind. Please note that the problems do require some mathematical/programming knowledge. However, you are not limited to just one way of finding the solution – there are multiple ways to come to an answer.
In the following post I will try to explain how I came to a certain answer (but I will not post the answers). The point of these post is to get you on the right track. It’s more rewarding to find the answers by yourself. However, if you are truly desperate, I will be posting working solutions that you can use to calculate the answer – but where is the challenge in that?
Also, please note that I’m using these problems to get a bit more familiar with the possibilities of PowerShell. As such, most of the solutions will be in PowerShell scripting language.