Problem 7, correct pattern generation for threads