Counting terms of an arithmetic progression
ID: counting-terms-of-an-arithmetic-progression
Starting at and repeatedly adding a nonzero common difference , a proposed final value is reached at positionif and only if this expression is a positive integer. For , , and , it gives . The quotient counts increments, while the initial entry adds one to the number of sequence terms. The proposed value gives , which is not an integer, so it is never reached by these updates. The test also handles decreasing arithmetic progressions; when , the repeated value alone cannot determine a length.
New to topics? Read the docs here!