If I have a integer sequence defined as $a_n={n \choose z}\ mod \ y$ for $n,\ x, \ y \in \mathbb Z$, I have found that it is periodic with length: $y\prod_{k=1}^z gcd(e^{\Lambda(k)},y)$, where $\Lambda(k)$ is the von Mangoldt function. (I have not proven this yet, but it seems related to Lucas's and Kummer's theorems.)
Then, if I have a function $f(x,y,z)$ that denotes the frequency of an integer $x$ in one period length of $a_n={n \choose z}\ mod \ y$, it appears that $f(0,2,z)=$ A073138 in OEIS and $f(0,y,2)=$ A034444 in OEIS.
I have this Mathematica code which I have been using to observe the patterns of this function:
f[x_, y_, z_] := Count[Table[Mod[Binomial[n, z], y], {n, 1, y*Product[GCD[E^MangoldtLambda[k], y], {k, 1, z}]}], x]
In addition, $\ f(0,p,z)$ where p is prime seems to have some interesting properties. $\ f(0,11,z)$ demonstrates an interesting repetition:
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 22, 31, 40, 49, 58, 67, 76, 85, 94, 103, 112, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 44, 51, 58, 65, 72, 79, 86, 93, 100, . . .}
Here's an image of the above.
My number theory knowledge is not sufficient to get much further with this problem, and I am currently uncertain how to proceed. Why is this pattern occurring? Can it be proven that this is true? Most importantly to me, how can I express $f(x,y,z)$ in a mathematical way? I have found some papers that talk about the periodicity of $a_n={n \choose z}\ mod \ y$ (like this one, for example), but they are beyond my current understanding. Any help would be appreciated! (This is also my first post, so sorry for any formatting errors.)
This question was previously posted on Math.SE, link.