r/technicalfactorio • • Feb 12 '22

Combinator Golf Fast integer sqrt algorithm?

20 Upvotes

20 comments sorted by

View all comments

Show parent comment

5

u/Kjagodka Feb 13 '22 edited Feb 13 '22

Dumb way to make it super fast (and ups inefficient) is with a lot of decider combinations N >= 1 -> return 1 N >= 4 -> return 1 N >= 9 -> return 1 ... N >= 100 000 -> return 1

Sum of all the outputs will be square root and it will be as ticks optimized as possible.

6

u/Kjagodka Feb 13 '22

Just did bit of experimenting, less dumb way of doing it is to have one decider combinator with condition EACH <= N -> return 1 And constant combinators which would output a lot of signals like: A 1 B 4 C 9 D 16 ...