This an example problem of arithmetic progression. Where there is a common of difference of 3. So theĀ formula
X = a1 + (n-1) d
Where x = 102 ( because is the first number greater than 100 that is divisible by 3
A1 = is the current amount of marble
N = number of times they need to behave
D = 3
102 = 24 + (n-2) 3
Solving for n = 27 times they need to behave