Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Fastest Growing Hierarchy

4: Adsense

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.


  • You cannot reply to this topic
No replies to this topic

#1 sooner123   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.