The formula here, if you take a look about it, it's something like the gold some, I guess.
Let's see.
I think it's the gold some or something.
Right.
Or hide one is.
It's not the ghosts.
All right, sopped for height, age, let's say, let's notice that you have how many triangles do you
have?
Well, you have one triangle here on top.
Then two triangles, three triangles and so on and so forth.
And on the last layer of triangles, the only difference is that those triangles have one edge in minus.
Right.
So the answer is the number of triangles, which is one plus two plus three.
Plus dot, dot, dot.
Plus each.
This is the number of triangles.
Each triangle has free edges.
But the triangles which are here on the last layer, on the bottom layer of one in minus.
So we will subtract each.
This formula is, of course, free crust.
H.
Age plus one divided by two minus age, which I think you can write us, I think, free.
Age Square, the year free age squared minus age divided by two, which is free.
Divided by two.
H.
Minus one.
All right.
So you have this formula.
But as the problem suggests, you're going to find the greatest age such that this number is less or
equal than an.
The beautiful thing about this.
Is that you have this product?
Each crossed age minus one.
Which is almost equal to age squit.
Which means each is going to be closed to ask here, cured of an.
And that was the whole.
Because when you are trying all these possible heights, you will always reach at most a security of
any right.
You can do something like try to hide.
Try one to free dot, dot, dot until you get to the greatest one.
Such that this formula is less or equal than N.
Right.
Let's call it marks a.
And after you have found Max H.
So you know what is going to be the maximum height of some pyramid?
You will start now from max age, but go in the opposite direction.
You know, Max H.
You decrease from n this formula for Mux H.
Then you are left with one other end and one which is way less than N.
So you have to find the next max age.
And now you can just move backwards in order to find the max age.
Right.
By doing this and not always, always finding again from the bottom.
The new max age.
What you're gonna have here is basically two crossed max age iteration at.
Which is pretty cool.
So you foreign marks age.
You know, this is the greatest one.
And then move backwards to cross marks age.
But again, let's not forget that age is almost the max age actually is going to be close to obscurity
of.
And so you have something like a day of M.
Total iterations.