Quoting Fred Lunnon <fred.lunnon@gmail.com>:
What sort of application is envisaged for such counters, and why would "unidirectional" algorithms be unsuitable? WFL
My cipher HPC processes "arbitrarily long" arrays. It makes three passes over the array, in three different orderings. The algorithm requires that the indexing can also run backwards relatively cheaply, so simple schemes are best. The first pass indexing is ordinary counting from I=0 to 2^K-1. The second pass uses the ordering I' = 5I + 1 (mod 2^K). The third pass uses a finite field of size 2^K, and the indexing order I' = xI (mod x^K + ... + 1). The modulus is the smallest mod2 polynomial of degree K for which x is a primitive root, going through all 2^K-1 non-zero values. The present program needs all the data to be in memory at once. I'd like to be able to process the data somewhat sequentially, to do files bigger than memory. The first ordering is trivial, and I've worked out a scheme for the second ordering, but the third ordering has resisted my efforts. A giant sort is the best-so-far-- not especially appetizing. Rich