FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

string-data-structure/fibonacci-string: :shell: Fibonacci string for JavaScript · GitHub

Repository files navigation

Fibonacci string for JavaScript. See docs.

⚠️ Depending on your environment, the code may require regeneratorRuntime to be defined, for instance by importing regenerator-runtime/runtime.

import {makeIndex, query} from '@string-data-structure/fibonacci-string';

const F = makeIndex({iadd: (x, y) => x+y, zero: () => 1, one: () => 2}, 10);

query(F, 0); // 0
query(F, 1); // 1
query(F, 2); // 0
query(F, 3); // 0
query(F, 4); // 1
query(F, 5); // 0
query(F, 6); // 1
query(F, 7); // 0
query(F, 8); // 0
query(F, 9); // 1
query(F, 10); // 0

const Fn = makeIndex({iadd: (x, y) => x+y, zero: () => 1n, one: () => 2n}, 10n**100n);
query(Fn, 4802349082340928340983n); // 1n
query(Fn, 123456748023490823409283409834802349082340928340983n); // 0n

About

🐚 Fibonacci string for JavaScript

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL