User blog:VoidSansXD/Possibly non-recursive function

RULES:

1.)  You have a pet cat, place the cat on the floor.

2.)  Depending on the amount of hours the cat sleeps, walk through (the amount of hours the cat sleeps) doors.

3.)  Every time the cat sleeps, close the last door.

4.)  Once the last door is closed the amount of times the cat sleeps, close the second last door, and open the first last door..

5.)  Once the second door is closed the amount of times the cat sleeps, close the third last door, and open the second and first last door.

6.)  Once you close the first door, stop and get the number.  The number is the amount of times you closed the doors.

In C(n), n is the number of hours the cat sleeps.

Examples:

C(0) = 0

C(1) = 1

C(2) = 4

C(3) = 27

C(4) = 256

.

.

.

.

This MIGHT be a nonrecursive function but idk