News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Help Compiling Integers greater than 2bytes (32,768) (Ackermann Function)

Started by TJGeb180, November 04, 2010, 04:57:36 PM

Previous topic - Next topic

TJGeb180

Hey,

Looking for some advice on how to approach this I no Code::Blocks has long long ints which is up to 8bytes or 9..... something... I actually need to make this thing bigger haha. I'm working on Ackermann's functions trying to basically compute as many numbers as I can.

Here's my code (yes I no my exponents are not coded right)

int acker(int m,int n)
{
    if (m == 0)
        return (n + 1);
    if (m == 1)
        return (2 + (n + 3) - 3);
    if (m == 2)
        return (2 * (n + 3) - 3);
    if (m == 3)
        return ((pow(2,(n + 3))) - 3);
    if (m == 4)
        return ((2^(2^(n + 3))) - 3);
    if (m == 5)
        return ((2^(2^(2^(n + 3)))) - 3)
    if (m == 6)
        return ((2^(2^(2^(2^(n + 3)))))) - 3)
}


//Numbers to be put into function
int main()
{
   
             
   
    for(int i = 0; i < 1; i++){
            printf("%d ", acker(3,5));  // Inpute Ackerman numbers into acker()... Currently processing 2 bytes
                                               // Can not handle more then the Ackermann # (3,12) or (4,0)
                                                // Output must = less then 32768
    }
    return 0;

If you can get this to work to compute 2^65536 power which has 19,727 digits I'd really appreciate it and if u can get it to go even further lol and get it to compute 2^18,446,744,073,709,551,616 then I envy you haha.

Acker(3,12) = 32768
Acker(4,1) = 65533

the 2 numbers I'm trying to compute are

Acker(5,1) and Acker(5,3)

Thanks for the help guys

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Jenna

Unrelated to C::B (it's "just" an IDE not a compiler) and therefore violating our forum rules.

Note: this website is dedictaed to C::B and not to general programming questions only.

Topic locked !