# How to get the recursive formula of a problem?

I am trying to understand a problem im reading and produce a recursive formula for the problem.

The problem, an ice cream van can serve j^2 customers at a time, However the van needs time to make new ice cream so j is equal to the time since it last made ice cream.

Given a set of customers coming by the minute in groups: x = {1,13,15,2}

what would be the best times to serve? in this case it would be the 3rd and 4th minutes.. as min(15,3^2) = 9 and min(2,3^2) = 9

How can produce a recursive formula for such a problem?

-

It sounds like you want the $j$ that results in $\max_j (\min(\text{customers}(j), j^2)$. Is that what you want?