The length of the recurring pattern depends on p, the denominator. For example 5/37=0.135135... and 17/37=0.459459... both of which have a recurring pattern of 3 digits.
7/13=0.538461 and 11/13=0.846153 (both 6 digits long with the digits in the same cyclic order).
So q does not affect the number of digits in the recurring decimal.