For two positive integers n and d, let Sn(d) be the set of all ordered d-tuples (x1,x2,…,xd) that satisfy all of the following conditions:
i. xi∈{1,2,…,n} for every i∈{1,2,…,d};
ii. xi=xi+1 for every i∈{1,2,…,d−1};
iii. There does not exist i,j,k,l∈{1,2,…,d} such that i<j<k<l and xi=xk,xj=xl;
a. Compute ∣S3(5)∣
b. Prove that ∣Sn(d)∣>0 if and only if d≤2n−1.