Files
ValueScript/inputs/passing/projEuler/p25.ts
Andrew Morris d2c437a9b6 BigInt
2023-03-20 17:59:07 +11:00

19 lines
362 B
TypeScript

// test_output! 4782
export default function main() {
let fibLast = 1n;
let fib = 1n;
let fibIndex = 2;
// TODO: Remove the temptation pull out this constant (optimization to eval
// known expressions).
const threshold = 10n ** 999n;
while (fib < threshold) {
[fib, fibLast] = [fib + fibLast, fib];
fibIndex++;
}
return fibIndex;
}