# How many folders?

1. Oct 25, 2005

### WarrickF

Hi All,

Quick disclaimer – I'm no math genius ;)

I have written a quick script that take as it's input the number of levels you'd like to iterate and the number of folders at each level you'd like to create.

So you have 4 base folders, in each folder you have 4 more folders etc. 4 levels deep.

The math to calculate how many folders there are at the end of the day looks something like this:

4^4 + 4^3 + 4^2 + 4^1

I can do this math manually, but I have no idea how to create a formula that allows me to plug in any number. Lets say I wanted to go 12 levels deep .. how many folders would I end up with? I can do this manually of course, but then I would learn nothing and run into the same problem a yeaqr from now when I need to do the same math with 1000 folders ;)

I'm trying to do this in Excel \ Open Office so any formula references you can give would also be greatly appreciated.

Thanks
Warrick

2. Oct 25, 2005

### shmoe

it's a geometric series:

$$\sum_{i=0}^{n}r^i=\frac{1-r^{n+1}}{1-r}$$

(r not equal to 1)