Syntax for Table[ ]
Math 202 Cryptography
September 20, 2022

T. Ratliff, Wheaton College
ratliff_thomas@wheatoncollege.edu

Basic Examples of Table[ ]

Mathematica’s Help describes the syntax better than I can, so I’ll just give a few examples.

t1 = Table[i, {i,1,10}]
t1 //TableForm

n=13
t2=Table[ Mod[i^2, n], {i,1,n-1}]
t2 //TableForm

n=13
t3=Table[ {i,Mod[i^2, n]}, {i,1,n-1}]
t3 //TableForm

EulerPhi[n]

Not surprisingly, Mathematica has the Euler ϕ function built in

EulerPhi[11]

EulerPhi[12]

Combining the two

This will compute (a^(ϕ(n)+1))mod n for a=0, . . ., n-1

n=5
phi = EulerPhi[n]
Table[ {a, Mod[ a^(phi+1), n]}, {a,0,n-1}] //TableForm