{"id":27147381,"url":"https://github.com/excoffierleonard/fib-rs","last_synced_at":"2026-02-03T20:01:08.214Z","repository":{"id":285484098,"uuid":"958170440","full_name":"excoffierleonard/fib-rs","owner":"excoffierleonard","description":"A highly optimized Fibonacci number calculator for Rust that efficiently computes arbitrarily large Fibonacci numbers.","archived":false,"fork":false,"pushed_at":"2026-01-30T04:47:44.000Z","size":208,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-30T21:10:26.317Z","etag":null,"topics":["algorithm","fib","fib-rs","fibonacci","math","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/fib-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/excoffierleonard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-31T18:56:33.000Z","updated_at":"2026-01-30T04:44:25.000Z","dependencies_parsed_at":"2025-04-22T17:31:22.544Z","dependency_job_id":"e3d5a1aa-dfe3-4957-8a78-b438ec262392","html_url":"https://github.com/excoffierleonard/fib-rs","commit_stats":null,"previous_names":["excoffierleonard/fib-rs"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/excoffierleonard/fib-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excoffierleonard%2Ffib-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excoffierleonard%2Ffib-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excoffierleonard%2Ffib-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excoffierleonard%2Ffib-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/excoffierleonard","download_url":"https://codeload.github.com/excoffierleonard/fib-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excoffierleonard%2Ffib-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29055589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T15:43:47.601Z","status":"ssl_error","status_checked_at":"2026-02-03T15:43:46.709Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","fib","fib-rs","fibonacci","math","rust"],"created_at":"2025-04-08T11:25:57.123Z","updated_at":"2026-02-03T20:01:08.182Z","avatar_url":"https://github.com/excoffierleonard.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fib-rs\n\n[![Crates.io](https://img.shields.io/crates/v/fib-rs)](https://crates.io/crates/fib-rs)\n[![Crates.io](https://img.shields.io/crates/d/fib-rs)](https://crates.io/crates/fib-rs)\n[![Documentation](https://img.shields.io/docsrs/fib-rs)](https://docs.rs/fib-rs)\n[![MIT](https://img.shields.io/crates/l/fib-rs)](LICENSE)\n[![CI/CD](https://github.com/excoffierleonard/fib-rs/actions/workflows/ci-cd.yaml/badge.svg)](https://github.com/excoffierleonard/fib-rs/actions/workflows/ci-cd.yaml)\n\nA highly optimized Fibonacci number calculator for Rust that efficiently computes arbitrarily large Fibonacci numbers.\n\n**[Try the web demo](https://fib.excoffierleonard.com)**\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Performance](#performance)\n- [Algorithm Details](#algorithm-details)\n- [Web Demo](#web-demo)\n- [License](#license)\n- [Contributing](#contributing)\n\n## Features\n\n- **Fast doubling algorithm**: Calculates Fibonacci numbers in O(log n) time\n- **Handles massive inputs**: Compute Fibonacci numbers up to F(10,000,000) and beyond\n- **Range calculation**: Generate sequences of consecutive Fibonacci numbers with parallel processing\n- **CLI application**: Simple command-line interface for quick calculations of single values or ranges\n\n## Installation\n\n### Library\n\nTo use as a dependency in your project:\n\n```bash\ncargo add fib-rs --no-default-features\n```\n\n### CLI Tool\n\nTo install the command-line tool with cargo for all platforms (recommended):\n\n```bash\ncargo install fib-rs\n```\n\nOr for Linux only:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/excoffierleonard/fib-rs/main/scripts/install.sh | sh\n```\n\n## Usage\n\n### As a library\n\n```rust\nuse fib_rs::Fib;\n\n// Calculate F(100)\nlet n = 100;\nlet result = Fib::single(n);\n// Print the result\nprintln!(\"F({}) = {}\", n, result);\n\n// Calculate a range of Fibonacci numbers (F(3) through F(10))\nlet start = 3;\nlet end = 10;\nlet results = Fib::range(start, end);\n// Print the results\n(start..=end)\n    .zip(results.iter())\n    .for_each(|(i, result)| println!(\"F({}) = {}\", i, result));\n```\n\n### Command-line application\n\n#### Single\n\n```bash\nfib single 100\n```\n\n```bash\nF(100) = 354224848179261915075\n```\n\n#### Range\n\n```bash\nfib range 6 10\n```\n\n```bash\nF(6) = 8\nF(7) = 13\nF(8) = 21\nF(9) = 34\nF(10) = 55\n```\n\n## Performance\n\nSpecifications:\n\n- 15-inch MacBook Air (2025)\n- M4 Chip, 10C CPU, 10C GPU\n- 32GB Unified Memory\n- macOS Tahoe 26.2\n\n| Single        | Computation Time |\n|---------------|------------------|\n| F(1,000)      | ~876ns           |\n| F(10,000)     | ~8.38μs          |\n| F(100,000)    | ~332μs           |\n| F(1,000,000)  | ~10.6ms          |\n| F(10,000,000) | ~323ms           |\n\n| Range                | Computation Time |\n|----------------------|------------------|\n| F(0) -\u003e F(1,000)     | ~55.1μs          |\n| F(0) -\u003e F(10,000)    | ~436μs           |\n| F(0) -\u003e F(100,000)   | ~20.2ms          |\n\n## Algorithm Details\n\n### Single Fibonacci Number\n\nFor computing a single Fibonacci number, this implementation uses the fast doubling algorithm with logarithmic time complexity:\n\nFor even n: F(2k) = F(k) *(2*F(k+1) - F(k))\n\nFor odd n:  F(2k+1) = F(k+1)^2 + F(k)^2\n\nThis divide-and-conquer approach is vastly more efficient than naive recursive or iterative methods for large inputs.\n\n### Fibonacci Range\n\nThe range implementation combines two approaches for optimal performance:\n\n1. **Parallel processing**: Divides the requested range into optimal chunks based on available CPU threads\n2. **Smart initialization**: Uses the fast doubling algorithm to efficiently find the starting values for each chunk\n3. **Iterative calculation**: After finding starting values, computes subsequent Fibonacci numbers iteratively within each chunk\n\nThis hybrid approach provides excellent performance for generating sequences of consecutive Fibonacci numbers, especially for large ranges, by leveraging multi-core processing while maintaining mathematical efficiency.\n\n## Web Demo\n\nTry the interactive [web demo](https://fib.excoffierleonard.com) to calculate Fibonacci numbers directly in your browser. The demo showcases the library's performance and capabilities through a WebAssembly implementation.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcoffierleonard%2Ffib-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexcoffierleonard%2Ffib-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcoffierleonard%2Ffib-rs/lists"}