Summing the Fibonacci Sequence

The golden ratio.

An image from nature (by Sustainable San Mateo). The golden ratio approximately (this is a topic for discussion) appears in here and is closely related to the Fibonacci sequence.

Consider the following problem (Project Euler, Problem #2):

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.

Solving this problem by using a programming language is relatively easy and requires only looping through the sequence. How can you tackle this problem without the need for a computer? Spoiler alert: there is only one final step in which we will use a calculator.

(more…)

Read More

Why Scala?

scala-logo

Scala is jet another programming language in the world of programming languages. Its first version was released in 2001 and was conceptually developed by┬áMartin Odersky, a professor at the EPFL in Switzerland. Fun fact: one of his first projects was called Pizza and was a super set of the Java language. Later on, he developed Scala. The name and logo are easy to explain. First of all, Scala stands for SCalable LAnguage. Another translation: “Scala” means “staircase” in Italian. The logo is based on a particular staircase in one of the buildings of EPFL. Now we have had a decent introduction to Scala, we can start exploring the language itself. So what is Scala all about?

The inspiration for the Scala logo.

The inspiration for the Scala logo.

(more…)

Read More