Given N inputs placed in sequence into S slots, how many times can you cycle the inputs into the slots before the initial sequence repeats? For example, you have a list of 4 items: A, B, C, D. You have three slots each input can go into, and it repeats indefiniely. So the sequence to fill them would go:

*

*ABC

*DAB

*CDA

*BCD

*ABC* repeats
So in this case, with 4 items and 3 slots, it repeats every 4 cycles.

Another example, 3 items, 3 slots

*

*ABC

*ABC
In this case, it repeats every 1 cycle.

Or, 6 items, 5 slots

*

*ABCDE

*FABCD

*EFABC

*DEFAB

*CDEFA

*BCDEF

*ABCDE* repeats every 6 cycles

Looking at different examples, I haven't been able to retrofit any kind of formula into this problem. I'm hoping there's a type of math out there I'm not familiar with that can be used to create a formula.
Imagine for the sake of this challenge that people are trying to come up with a way to determine how many inputs or slots to use in order to maximize the number of unique cycles.
 A: An alternate formulation is that you have an infinite sequence of letters/inputs, which start as $N$ different ones and repeat forever. For $N=4$ that means:
$$ABCDABCDABCDABCD...$$
Now you parcel that sequence into packets of consecutive letters of length $S$, starting at the beginning and starting a new packet immediately after the previous one ended. For $N=4, S=3$ we get:
$$ ABC\;\;DAB\;\;CDA\;\;BCD\;\;ABC\ldots$$
Your question is then how many parcels you have before the first parcel comes up again. In this case, the answer is 4, as you already found and explained.
Since the sequence is periodic with minimal perid $N$, and all the first $N$ elements are different, the element $A$ comes up in exactly the positions $1, N+1, 2N+1,\ldots$, so generally the position $kN+1$ for an integer $k \ge 0$.
When do we get a repeat of the first parcel? It has to start with $A$, just as the first parcel. But this is already enough, if the first letter of a parcel is $A$, the second will be $B$, a.s.o. so such a parcel is a copy of the first parcel.
So in what positions will the first letters of a parcel land? This is easily seen as $1, S+1, 2S+1,\ldots$ or generally $lS+1$ for an integer $l \ge 0$.
So the question comes down to what the smallest positive integer solutions  of
$$kN+1 = lS+1$$
are (k=0, l=0 lead to the first parcel being a copy of the first parcel, which is not what we are interested in).
So $kN=lS$, and if $k$ and $l$ are minimal positive, so are $kN$ and $lS$, respectively. So we are locking for the smallest integer which is both a positive multiple of $N$ and of $S$, which is generally know as the "least common multiple" and usually abbreviated "lcm" (see https://en.wikipedia.org/wiki/Least_common_multiple for more details)!
That value is used in many situations and most people remember it from the time they had to learn how to add fractions, because the least common multiple of the denominators is what you need to determine first.
Since you are interested in the cycle length, that would be the value of $l$. So we get
$$l_{min}= \frac{lS}S = \frac{\mathrm{lcm} (N,S)}S$$.
There are other ways to write the above equation. For example using the "greatest common divisor" (gcd) of $N$ and $S$ and using the formula $\mathrm{lcm} (N,S) \mathrm{gcd} (N,S) = NS$ we get
$$l_{min}= \frac{N}{\mathrm{gcd} (N,S)},$$
which may be more handy because the gcd is the smaller number.
You can check that this gives the correct values for all the cases you mentioned in your problem.
Finding the gcd of 2 numbers is relatively straightforward if they are small. If they are larger, "guessing" may no longer work, but the excellent Euclidean Algorithm can help there.
