# Is there any simplification to:$\mod(P_{k-1}\# \cdot J , \; P_k )\quad$?

Is there any way to simplify or to find pattern in:

$$\mod(P_{k-1}\# \cdot J , \; P_k ) \quad with\quad J=0:P_k-1$$ Sorry for not being clear at notaion, i will try to do it by example:

$$P_k=kthprime(k)\quad$$ (Example: $$P_1=2\,,\quad P_2=3\,,\quad P_3=5\,, \quad etc...)$$

$$P_{k}\#=\prod_{i=1}^{k}P_i\quad$$ (Example: $$P_1\#=2\,,\quad P_2\#=6\,,\quad P_3\#=30\,, \quad etc...)$$

$$J$$ is integer running from $$0$$ to $$P_k-1$$

And matlab code example:

P=primes(7), Pk=P(end), prevprimorial=prod(P(1:end-1)), J=0:Pk-1, R=mod(prevprimorial*J,Pk)


Output:

P =
2     3     5     7
Pk =
7
prevprimorial =
30
J =
0     1     2     3     4     5     6
R =
0     2     4     6     1     3     5


And my question is about the residuals R, if we can find some rule for the pattern there. (Primorial inside $$mod$$ is with high growth of frequency and thats makes it look very chaotic)

What do i look for?

For different k we will have different $$R$$, the first element of $$R$$ (i.e. the result of $$J=0$$) will always be $$0$$.

Given $$k$$, i want a simple formula as a function of $$k$$ that will tell me what $$J$$ will result in residual $$1$$. (In the matlab example ($$k=4$$) the $$R=1$$ is result of $$J=4$$)

Or, alternatively, given $$k$$, what is the $$R$$ for $$J=1$$ . (In the matlab example ($$k=4$$) the $$J=1$$ results in $$R=2$$)

Or, other question, how easy it is to prove or disprove for example for $$k=123456789$$ the equation $$\mod(P_{123456789-1}\# \cdot 987 , \; P_{123456789} ) = 123$$ ?

• That would help to precise from which sets those elements belong to and the meaning of the symbols you use!!! – mathcounterexamples.net Aug 16 at 15:50
• @ mathcounterexamples, did it. – Mendi Barel Aug 16 at 16:24
• The vector R looks very far from chaotic: it is in fact an arithmetic progression mod $P_k$. You really need to be more specific about what you are trying to simplify. As it is (with one small optimization in the code), it takes only a bit longer to generate $R$ as it does to generate any list of length $k$. – Erick Wong Aug 16 at 16:32
• @Erick added a clarification at the end. – Mendi Barel Aug 16 at 16:35
• That helps a lot, thanks. Are you familiar with Euclidean algorithm? You don’t need to generate all of $R$ just to find the entry that’s 1. If all you are interested in is that, it seems like a distraction to ask about $R$: – Erick Wong Aug 16 at 16:48