The dimension of a variety V of algebras is the greatest length of a basis (i.e., of an independent generating set) for an SC-theory SC(V), consisting of strong Mal'tsev conditions satisfied in V. The variety V is assumed infinite-dimensional if the lengths of the bases in SC(V) are not bounded. A simple algorithm is found for constructing a variety of any finite dimension r≥1. Using the sieve of Eratosthenes, r distinct primes p1, p2,…, pr are written and their product n=p1p2…pr computed. The variety Gn of algebras (A, f) with one n-ary operation satisfying the identity f(x1, x2,…,xn)=f(x2,…,xn, x1) has, then, dimension r.