Function fibonacci

  • Get the nth number in the fibonacci sequence (0-indexed)

    Parameters

    • input: number

    Returns number

    Example

    import { number } from "@rjweb/utils"

    number.fibonacci(5) // 5
    number.fibonacci(10) // 55
    number.fibonacci(0) // 0
    number.fibonacci(-1) // 0
    number.fibonacci(1) // 1
    number.fibonacci(1.5) // 1
    number.fibonacci(21.23) // 10946

    Since

    1.12.17

    Supports

    nodejs, browser