FFiboLantern
Workflows

Coding workflows · Fast-doubling Fibonacci

03
Built around your work

A concrete starting point

Compute Fibonacci numbers by fast doubling for integer indices from zero through 10000. Check the first two values, a known larger term and the upper bound, rejecting fractional, negative or Boolean indices.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Fast-doubling Fibonacci

A concrete starting point
def fibonacci(index):
    if type(index) is not int or not 0 <= index <= 10000:
        raise ValueError("index.range")
    a, b = 0, 1
    for bit in bin(index)[2:]:
        c = a * (2 * b - a)
        d = a * a + b * b
        a, b = (c, d) if bit == "0" else (d, c + d)
    return a

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗