The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [fibonacci-sequence]

The Fibonacci sequence is the sequence defined by F(0) = 0, F(1) = 1, F(n + 2) = F(n) + F(n + 1). The first few terms are 0, 1, 1, 2, 3, 5, 8.

Filter by
Sorted by
Tagged with
9
votes
2answers
5k views

Fibonacci generator with Golang

This is my Fibonacci generator: package main import "fmt" func main() { for i, j := 0, 1; j < 100; i, j = i+j,i { fmt.Println(i) } } It's ...
2
votes
2answers
10k views

Fibonacci sequence implementation

This was too slow for my computer: ...
2
votes
3answers
932 views

Project Euler - Shortening Problem 2

You might have read my question on shortening my code to a one-liner for Problem 1. So, I was wondering, is there any more tricks of the trade to shorten my Problem 2 solution: ...
4
votes
3answers
2k views

Making this reduce() Fibonacci generator better

I've recently discovered how cool reduce() could be and I want to do this: ...
3
votes
1answer
279 views

Euler 2 : Simple Fibonacci

I'm just starting to experiment with F# (from a C# background). I think I'm starting to get into the right way of thinking, but this code still seems pretty awkward. Is there a better (more terse) ...
4
votes
2answers
4k views

Ruby Fibonacci(n) recursive computation optimized with reflection

The idea is to take the common-known (and awfully bad performing) Fibonacci(n) recursive method: ...
2
votes
1answer
3k views

Fibonacci heap implementation

I'd like this reviewed. ...
11
votes
4answers
22k views

Python Solution for Project Euler #2 (Fibonacci Sums)

I'm a fairly new programmer (just started yesterday!). I decided to tackle Project Euler #2 today, as I did #1 yesterday without many problems. I came up with what seems to me to be a working solution,...
4
votes
1answer
503 views

Project Euler question 2 in CoffeeScript

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. ...
3
votes
3answers
662 views

Fibonacci implementation in Go

At the end of the Day 1 Go Course slides (pdf) there is an exercise stated as follows (NOTE: the course in the linked presentation is considered obsolete. If you are looking to learn Go the suggested ...
5
votes
2answers
827 views

Producing full list of Fibonacci numbers which fit in an Int

I am progressing through the problems listed at projecteuler.com as I learn Scala (my blog where I am covering this experience). I have written a function to produce all the Fibonacci numbers possible ...
7
votes
2answers
750 views

Terminating a C loop when maximum hardware limit reached

In response to the SO question C: f>0 vs Perl: $f>0?, the use of overflow to terminate the loop is referred to as "poor programming practice". Paraphrased: Your c code is actually exiting because ...
23
votes
3answers
2k views

Project Euler Problem 2 in Clojure

I am in the process of learning Clojure. I am fairly new to functional programming and would like to know if my code smells or if there are any performance implications with my approach. ...