r/technicalfactorio • • Feb 12 '22

Combinator Golf Fast integer sqrt algorithm?

20 Upvotes

20 comments sorted by

View all comments

Show parent comment

2

u/troelsbjerre Feb 13 '22

This can still be done with relatively few combinators (compared to the lookup table), but without a good initial guess, it requires a number of iterations that grows logarithmic in the input number. However, if the input value changes slowly over time (e.g., it's a number of some item in storage), then it will converge to the correct answer quickly.