There are X biscuits, which are distributed to 4 people, 6 people and 9 people, and each person can get a, b and c biscuits respectively.
X=4a+2
X=6b+2
X=9c+2
That is 4a+2=6b+2=9c+2.
a=9c/4 b=9c/6
Because there are less than 40 biscuits, X = 9c+2.
Because the number of cookies is a positive integer, the value of c may be 1, 2, 3, 4.
When c = 1, 2, 3, neither a nor b is an integer.
Only when c=4, a=9c/4=9 and b=9c/6=6 can the requirements be met, that is, the number of biscuits is X=4a+2=38.