Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


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.

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

#1 sooner123   Members   -  Reputation: 241

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.


Sponsor:



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.



PARTNERS