I have a list v
in sageMath worksheet like this
v = [3, 5, 22, 35, 230, 308, 683, 6546]
m = 14002
a = 185
and then I do modulus calculations on every number in the list
for i in range(0, len(v)):
v[i] = mod(v[i] * a, m)
my problem is when I later want to do other calculations with the list the mod() function is somehow still remembered by the list. I have tried to copy the list to another list, it doesn't work.
For example, this loop below returns 6714
but should return 20716
and
20716 % 14002 = 6714
for i in range(len(v)):
c = c + v[i]
I solved the problem by doing one more modulu calculation on v like
for i in range(len(v)):
v[i] = mod(v[i], next_prime(m*m))
My question is if there are any better way to solve the problem