Perhaps there is no single formula that accounts for all the time intervals, but there is a method to get formulas for each compound interest period. You deposit money monthly but there is interest applied weekly. Let's assume the month has 4 weeks.
So you added x in the end of the first month, when the new month starts, you have x money in your account. After one week, you have x + bx money. After the second week, you have x + b(x + bx) and so on. Always taking the previous ammount of money and multiplying it by the interest (b) you have. This gives you for the end of the second month:

This looks complicated, but it's easy for computers. Call it f(0), that is: It is a function that gives you the ammount of money you would obtain by the end of the second month. Do you see that the future money inputs are given with relation to the previous ones? Then we can do the following, for n>1
(notice the x is the end of the formula, it's the deposit of money in the end of the month, I'm assuming it'll pass through the compound interest only in the first week of the next month):

And then write:

There is something in mathematics called recurrence relation in which we can use these two formulas to produce a simplified one for arbitrary b and n. Doing it by hand would be a bit complicated, but fortunately CASes are able to do it easily. I used Wolfram Mathematica commands:
FullSimplify[
RSolve[{f[0] ==
x + b x + b (x + b x ) + b (x + b x + b (x + b x )) +
b (x + b x + b (x + b x ) + b (x + b x + b (x + b x ))),
f[n] == b f[n - 1] + b (b f[n - 1]) +
b ( b f[n - 1] + b (b f[n - 1])) +
b (b f[n - 1] + b (b f[n - 1]) +
b ( b f[n - 1] + b (b f[n - 1]))) + x}, f[n], n]
]
And it gave me the following formula:

All the work you actually have to do is to figure out what will be f(0) and then write the f(n) for n>0
in terms of f(n-1). Notice that I used the command FullSimplify
in my code, Mathematica comes with algorithms for simplyfing formulas so if it didn't find something simpler, you probably won't find it by yourself! If the code looks ugly, it's because of Mathematica clipboard formatting, in the software, it looks like this:

Notice that I wrote the entire formula for f(0), but as it's also a recurrence relation, it can be written as:

That is: f(0)=g(4). This should give you much simpler formulas to apply in this method.