# Fastest Growing Hierarchy

This topic is 1868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

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

Here is the definition:

[b]Base function f[sub]0[/sub]:[/b] [b]f[sub]0[/sub](n) = n+1[/b]

[b]Next function f[sub](a+1)[/sub]:[/b] [b]f[sub](a+1)[/sub](n) = f[sub]a[/sub][sup]n[/sup](n)[/b]

[b]Functional powers:[/b] [b]f[sup](a+1)[/sup](n) = f(f[sup]a[/sup](n)) where f[sup]0[/sup](n) = n[/b]

[code]#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);
}[/code] Edited by sooner123