Answer:
(i) Each position can be filled in 4 ways, so there are 4 codes of length 1, 42=16 of length 2, 43=64 of length 3, and so on: a G.P. with a=4, r=4. For L=5:
4+16+64+256+1024=4−14(45−1)=1364
(ii) With maximum length L, the number of codes is
SL=34(4L−1)
S7=34(16384−1)=21844, which is not more than 50000. S8=34(65536−1)=87380, which is more than 50000. So the least value is L=8.