a) The first digit of the period is at least 1 if and only if n1≥101, that is n≤10. Since the prime factors of n must be different from 2 and 5, it follows that n∈{3,7,9}; indeed, in this case 31=0,(3), 71=0,(142857) and 91=0,(1).
b) Let p be the largest 4-periodic prime; then p1=9999m, with 1≤m≤9998. This yields pm=9999=32⋅11⋅101. So, the candidate for the largest such prime is p=101, which is acceptable, because 1011=0,(0099).