Page 1 of 1

Prime number checker

Posted: Sun Jan 14, 2018 10:02 pm
by ArcusVonSinus
I made a circuit computer, which determines if the number of all items in a chest is a prime number, then it will light up green. Otherwise it will light up red. The power pole is just to indicate where is the index which goes from 2 to the number of items (the largest among all sorts of them).

Image

https://factorioprints.com/view/-L2qdWZACpEIgd6i-7Ex

Re: Prime number checker

Posted: Fri Mar 26, 2021 9:54 am
by DaveMcW
Here is a smaller and faster version, using the new "modulo Each" operator. It works for up to 160,000 items.



prime.jpg
prime.jpg (84.07 KiB) Viewed 1392 times

Re: Prime number checker

Posted: Fri Mar 26, 2021 10:01 am
by ArcusVonSinus
Nice!
Mine works itemwise, it checks if there is a prime amount of every item. But it is much slower :-)