Looking to input a $p$ for the first line:
p=6;
Build a list of primes from the 3rd to $p-1$:
plist=Table[Prime[n],{n,3,p-1}];
Then build a list as follows:
bmod=Outer[Mod,{3*Prime[p]},plist]
Here's the code so far with the output:
p=6;
plist=Table[Prime[n],{n,3,p-1}];
bmod=Outer[Mod,{3*Prime[p]},plist]
{{4,4,6}}
Now I'd like to multiply each element of the list by $2$, but keep them mod their original prime, so instead of:
{{8,8,12}}
I get:
{{3,1,1}}
Then, I'd like to add this list to the original, still keeping the modular bounds:
{{3,1,1}}
+
{{4,4,6}}
=
{{2,5,7}}
And then repeat this process several times, always adding to the previous line:
{{4,4,6}}
{{2,5,7}}
{{0,6,8}}
{{3,0,9}}
etc.
Assuming you've followed my so far, how would I do that?