An open API service indexing awesome lists of open source software.

https://github.com/wmartinmimi/fibonacci-java

Calculate the nth fibonacci number using java
https://github.com/wmartinmimi/fibonacci-java

fibonacci fibonacci-sequence gplv3 java

Last synced: 9 months ago
JSON representation

Calculate the nth fibonacci number using java

Awesome Lists containing this project

README

          

# fibonacci-java

## Description

Calculate the nth Fibonacci number using java.

A fun simple project I played with.

## Files

- Fib.java

First version of the calculation.

Fn(n + 1) = F(n) + F(n - 1)

- FibN.java

Second version of the calculation.

F(2n) = (2F(n) + F(n - 1)) * F(n)
F(2n - 1) = F(n - 1)² + F(n)²

- FibT.java

Third version of the calculation.

Does essentially the same as FibN.java,
but first generate quick path from top to bottom
before calculating from bottom to top using the path.

Now also work with negative nth Fibonacci.

## Usage

```bash
java Fib.java
```

or

```bash
java FibN.java
```

or

```bash
java FibT.java
```

Example

```bash
java FibT.java 10000
```

## Last Readme update

- Date: 03-02-2023 dd-MM-yyyy