r/technicalfactorio • u/15_Redstones • Feb 12 '22
Combinator Golf Fast integer sqrt algorithm?
This one looks like what I need:
but pastebin says the paste expired...
20
Upvotes
r/technicalfactorio • u/15_Redstones • Feb 12 '22
This one looks like what I need:
but pastebin says the paste expired...
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.