Nacci Demo
https://www.npmjs.com/package/nacci
JavaScript
// See https://www.npmjs.com/package/nacci for documentation
import * as nacci from 'https://esm.run/nacci';
// START CONFIG
const index = BigInt(2**25);
const seq = new nacci.BigFibonacci();
// END CONFIG
// OPEN THE DEVELOPER CONSOLE FOR OUTPUT
console.log(`1. Generating index ${index}...`);
let t0 = performance.now();
const value = seq.get(index);
let t1 = performance.now();
console.log(`Generated in ${t1 - t0}ms`);
console.log(`2. Converting to string...`);
t0 = performance.now();
const str = value.toString();
t1 = performance.now();
console.log(`Converted in ${t1 - t0}ms`);
console.log(`3. Logging...`);
t0 = performance.now();
console.log(str);
t1 = performance.now();
console.log(`Logged in ${t1 - t0}ms`);
console.log(`Length: ${str.length} digits`);