Everyone knows pre-calculated fibonacci tables are the only way to Go.
package main
// Precomputed table up to N = 93
varfibTable=[94]uint64{0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170,1836311903,2971215073,4807526976,7778742049,12586268925,20365010974,32951279899,53316290873,86267570772,139583861645,225851432417,365435294062,591286726479,956722020541,1548008747020,2504730767561,4052739514581,6557470282142,10610209796723,17167680078865,27777889875588,44945569954453,72723459830041,117669029784494,190392489614535,308061519399029,498454009013564,806515528412593,1304969537426157,2111485065838750,3416454603264907,5527939669103657,8944394272368564,14472333941472221,23416728213840785,37889062155313006,61305790369153791,99194852524467597,160500642893621388,259695495418088985,420196138311710373,679891633729799358,1100087772041509731,1779979405771309089,2880067177812818820,4660046583584127909,7540113761396946729,12200160344981074638,
}
funcFibU64(nuint)uint64{if n <94{return fibTable[n]}panic("n exceeds uint64 capacity (n <= 93)")}
fibonacci.db I can already see it being vibe coded by tomorrow 🤣 and I can already see the AI generated README with emoji selling you 100x faster than other solutions.
View all comments
152
u/guesdo Oct 14 '26
Everyone knows pre-calculated fibonacci tables are the only way to Go.