Solution:
We use the following theorem of Lucas:
Theorem. Given a prime p and nonnegative integers a,b written in base p as a={anan−1…a0}p and b=bnbn−1…b0 respectively, where 0≤ai,bi≤p−1 for 0≤i≤n, we have
(ba)=i=0∏n(biai)(modp)
Now, let n=(p−1)×p+(p−2)=p2−2. For k=pq+r with 0≤q,r≤p−1, applying Lucas's theorem gives
(kn)≡(qp−1)(rp−2)(modp)
Note that
(qp−1)=i=1∏qip−i≡(−1)q(modp)
and
(rp−2)=i=1∏rip−1−i≡(−1)rr!(r+1)!=(−1)r(r+1)(modp)
So for 2≤i≤p we can take k=(p+1)(i−1) and obtain (kn)≡i (modp), while for i=1 we can take k=0. Thus this row satisfies the desired property.