Questions tagged [fibonacci]
The challenge involves Fibonacci numbers or one of their generalizations.
130 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
25
votes
8
answers
1k
views
Index into a Fibonacci tiling
The Cartesian plane can be tiled with increasingly large squares like so:
This tiling can be generated by starting with a square of side length 1, placed at the origin ...
13
votes
6
answers
871
views
What kind of Fibonacci subword at this offset?
When in the Fibonacci number recurrence fn+2=fn+fn+1 one replaces the "+" with string concatenation one will get the sequence of Fibonacci words. If we start with F0=a and F1=b, then the ...
2
votes
3
answers
331
views
Non-Decreasing Fibonacci Sequence modulo M
Given integers \$a,b,m, k, n\$ and array \$F = (f_1, f_2,...,f_n)\$ defined as:
\begin{cases}
f_1 = \text{a}\\
f_2 = \text{b}\\
f_i = (f_{i-1} + f_{i-2}) \text{ mod m},∀i > 2
\end{cases}
When \$F\$ ...
1
vote
2
answers
273
views
Write a function that takes an input string and encodes it using a modified Fibonacci sequence in reverse [closed]
Given an input string, first convert each character to its ASCII value.
Generate a reversed Fibonacci sequence of the same length as the input string.
Encode each character by adding its ASCII value ...
19
votes
5
answers
3k
views
Draw a Fibonacci Swoosh
Title courtesy of Greg Martin
For this challenge, I'll define an arc of size \$k\$ as a single piece of a sine wave with a length of \$k\$ units and an height of \$\frac{k}{4}\$ units:
And I'll ...
10
votes
6
answers
1k
views
Unnecessary Fluff
Following the great advice (what do you mean it's not advice?!) on Adding unnecessary fluff we can devise the following task:
Take a list of positive integers and a positive integer \$m\$ as input.
...
12
votes
4
answers
563
views
Zeckendorf to F(4k+2) representation
Background
Fibonacci numbers are defined as follows:
$$
F_0 = 0, F_1 = 1, F_n = F_{n-1} + F_{n-2}
$$
The Zeckendorf representation is a representation of positive integers as a sum of one or more non-...
30
votes
44
answers
4k
views
Repeat your program to print Fibonacci numbers
Write a program fragment so that, when repeated N times it prints the Nth Fibonacci number. For example, if your program is print(x) then:
...
13
votes
9
answers
3k
views
Give the fool's Fibonacci sequence
Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2:
...
1
vote
1
answer
242
views
Shorten this recursive even fibonacci implementation [closed]
I have the following Haskell code to generate the the values of the Fibonacci sequence which are even as an infinite list:
...
18
votes
7
answers
1k
views
Fibonacci Binary Squares
I was playing with the Fibonacci sequence in binary like so (note that the binary representations are written here from smallest bit to largest bit):
...
21
votes
4
answers
2k
views
Write a number as a sum of Fibonacci numbers
In 2009, Hannah Alpert described the "far-difference" representation, a novel way of representing integers as sums and differences of Fibonacci numbers according to the following rules:
...
17
votes
11
answers
3k
views
Fibonacci word fractal
The Fibonacci word is a sequence of binary strings defined as:
\$F_0 = \$ 0
\$F_1 = \$ 01
\$F_n = F_{n-1} F_{n-2}\$
The first ...
18
votes
16
answers
2k
views
Fibonacci polynomials
The Fibonacci polynomials are a polynomial sequence defined as:
\$F_0(x) = 0\$
\$F_1(x) = 1\$
\$F_n(x) = x F_{n-1}(x) + F_{n-2}(x)\$
The first few Fibonacci polynomials are:
\$F_0(x) = 0\$
\$F_1(x) ...
6
votes
3
answers
629
views
Generate Fibonacci Primes Quickly
Unsurprisingly, fibonacci primes are primes that are also Fibonacci numbers. There are currently 34 known Fibonacci primes and an additional 15 probable Fibonacci primes. For the purpose of this ...