There is million items in list,

what is the difference between seq and for loop ?

is seq faster than for loop?

it is very slow when running code below, how to speed up this part of code?

https://gist.github.com/LovelyYanki/c0b61fbb9d5954b34e03#file-gistfile1-txt

HSKeyIn := Table();

for ij from 1 to 1685159 do

s := solve([mm[ij][1,1]=1,mm[ij][1,2]=1,mm[ij][1,3]=1],[a,b,c]):

if nops(s) > 0 then

if (rhs(s[1][1]) = 1 or rhs(s[1][1]) = 0) and (rhs(s[1][2]) = 1 or rhs(s[1][2]) = 0) and (rhs(s[1][3]) = 1 or rhs(s[1][3]) = 0) then

#print(lhs(indices(T3, pairs)[ij])):

#print("***"):

h := HilbertSeries([mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]], {a,b,c}, z):

#print(h):

if not assigned(HSkeyIn[h]) then

if mod(ij, 100) = 0 then

print(ij):

end if:

HSkeyIn[h] := [[mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]]]:

else

if mod(ij, 100) = 0 then

print(ij):

end if:

HSkeyIn[h] := [op(HSkeyIn[h]), [mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]]]:

end if:

end if:

end if:

od: