# How to get Mathematica to loop two functions at once

So I know how to get half of this problem. I am trying to run a loop that combines the following two function at once so I can see from my index i if any number satisfies both conditions.

TO get the Sum of divisors mod a prime I write:

Table[{i,DivisorSigma[1,i]},{i,20}] // Mod[#,13] &


That code works great , I also want to know if the number is a perfect square. I use a similar code for that using Table[Sqrt[i],{i,20}] . What I want to know now is if I can compare both things side by side in my table or a column so something like:

Table[{i,Sqrt[i],DivisorSigma[1,i]},{i,20}] // Mod[#,13]&


Side note: The only down side to that type of code would be that it would mod the square root mod 13 and I just want to see if the number is a perfect square.

• {Mod[#, 13], Sqrt[#], Mod[DivisorSigma[1, #], 13]} & /@ Range@20 – OkkesDulgerci Mar 7 '19 at 23:17

Table[Riffle[Mod[{i, DivisorSigma[1, i]}, 13], Sqrt[i]], {i, 20}]


{{1, 1, 1}, {2, Sqrt, 3}, {3, Sqrt, 4}, {4, 2, 7}, {5, Sqrt, 6}, {6, Sqrt, 12}, {7, Sqrt, 8}, {8, 2 Sqrt, 2}, {9, 3, 0}, {10, Sqrt, 5}, {11, Sqrt, 12}, {12, 2 Sqrt, 2}, {0, Sqrt, 1}, {1, Sqrt, 11}, {2, Sqrt, 11}, {3, 4, 5}, {4, Sqrt, 5}, {5, 3 Sqrt, 0}, {6, Sqrt, 7}, {7, 2 Sqrt, 3}}

Also

MapAt[Mod[#, 13] &, Table[{i, Sqrt[i], DivisorSigma[1, i]}, {i, 20}], {All, {1, 3}}]


same result

• Spectacular thank you – argamon Mar 7 '19 at 23:09
• @argamon, you are welcome. – kglr Mar 7 '19 at 23:09