• Create Account

## Fastest Growing Hierarchy

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1sooner123  Members

269
Like
1Likes
Like

Posted 06 December 2012 - 02:05 PM

UPDATE: I figured it out. If you're interested, here was my problem and the solution is below.

In trying to write a recursive function that returns the fastest growing hierarchy (a really fast growing function).

Here is the definition:

Base function f0: f0(n) = n+1

Next function f(a+1): f(a+1)(n) = fan(n)

Functional powers: f(a+1)(n) = f(fa(n)) where f0(n) = n

#include <iostream>

using namespace std;

int hf(int, int);

int f(int x, int power, int functionalBase)
{
if (power==1) return hf(x, functionalBase);
else return f(f(x, power-1, functionalBase),1, functionalBase);
}

int hf(int x, int functionalBase)
{
if (functionalBase==0) return x+1;
else return f(x,x,functionalBase-1);
}

int main()
{
cout << f(2, 2, 2);
}

Edited by sooner123, 06 December 2012 - 02:33 PM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.