sea's blog → Algebra, Lisp, and miscellaneous thoughts

Table of Contents

Given a set of primes P and a starting integer n, find a sequence of increments I s.t. n + I₁, n + I₁ + I₂, n + I₁ + I₂ + I₃, … is not divisible by any of the primes in P.

This is actually straightforward. Such a sequence (and it repeats) always exists.

Work in G = Z/Zp₁ x Z/Zp₂ x … ,

First, project n into the group G to find its image. Verify that p has no zeroes (it is not divisible by any P).

Then, you just want to walk across the group without touching a zero. Eventually you cycle back to the starting n, and the increments you've gathered up will repeat. Just don't include the final increment that hits zero.