I had a warehouse job for a while, essentially being my own independent mini-factory within a larger factory, cutting conduit and packaging things up for shipping out.
Part of the job involved accurately counting hundreds or thousand of screws. I quickly found that visually grouping screws into groups of 4 on a large table was the fastest way to be 100% accurate. If I tried to do 5, sometimes I’d get a sort of confusion/uncertainty, not being quite clear if it was really 5, or 4 or 6, forcing me to check. I’d go on to group these little piles of 4, into larger groups of 4. So I got really good at counting in 4 and it’s multiples, 16, 64, 256.
I can definitely see 4 being generally optimal, unless one can expect perfect visual ordering, which is possible with text, but rare in the real world.