Skip to content

Commit 993547d

Browse files
committed
add comments for nth-fibonacci mini project
1 parent 9792847 commit 993547d

File tree

1 file changed

+8
-2
lines changed
  • projects/find-nth-fibonacci/src

1 file changed

+8
-2
lines changed

projects/find-nth-fibonacci/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
// use std::{}
1+
/*
2+
* We just follow this formula that gives us the nth number of the Fibonacci sequence
3+
* F(n) = (φ^n - (1-φ)^n) / √5
4+
* This function uses the `Golden Ratio` (φ), which is approximately equal to 1.618033988749895
5+
* The Golden Ratio is an irrational number that has unique properties, making it a fundamental element of mathematics and science
6+
* In the context of the Fibonacci sequence, the Golden Ratio is used to calculate the nth number in the sequence
7+
*/
28

39
// ============================================================================
410

5-
const GOLDEN_RATIO: f64 = 1.618033988749895; // known as φ (phi)
11+
const GOLDEN_RATIO: f64 = 1.618033988749895; // known as φ (phi), the Golden Ratio
612

713
fn main() {
814
// just clear the console for us

0 commit comments

Comments
 (0)