Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2006-08-22 21:43:39

Brendan Fafiani
Guest

### Exponential

Hi,
I am a programmer developing an application that will create a number of of objects in a hierarchial format. I have 2 variables available to the user. "Number of objects/items per branch" and "How many levels deep" So if 2,2 is selected the end result would be similar to this.

#
#
#
#
#
#

if 3,3 is selected the a result would look like this
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

Obviously increasing either of these numbers will cause the hierarchy(total amount of objects) to increase at an exponential rate can anyone suggest a method of calculating the total number of objects that would be created from a the 2 variables.

Thanks you,
Brendan Fafiani

## #2 2006-08-22 22:19:51

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

### Re: Exponential

Let's take a look at what those results actually are.

In your first example, you have a total of 2 objects in the first level (Because that's what your first number specified), then 4 objects in the next, because each of those 2 objects has 2 objects coming off it and it stops there because you specified that it has 2 levels.

So overall, you have 2 + 2² = 6 objects.

In the 2nd example, you have 3 objects in the first level, then 3² in the next and 3³ in the third, and then it stops because you specify it has 3 levels.
So, that's 3 + 3² + 3³ = 39 objects.

Generally, the formula for the amount of objects (if n is the amount of objects and L is the amount of levels) would be n + n² + n³ + ... + n[sup]L[/sup].

That formula is perfectly valid, but it's a bit messy for high values of L, so it's much easier to simplify it down to this:

With your two examples, this formula would do this:

Why did the vector cross the road?
It wanted to be normal.

Offline

## #3 2006-08-22 22:31:45

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

### Re: Exponential

the sum of geometric progression (a = objects, b = levels)

so lets test it out

you could also write it

ah blasted, mathsyperson beat me to it, stupid breakfast

Last edited by luca-deltodesco (2006-08-22 22:41:22)

The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

## #4 2006-08-22 22:41:18

Brendan Fafiani
Guest

### Re: Exponential

Sweet! Thanks you very much. Your reply rings a bell back to my college days.
Regards,
Brendan Fafiani.