My guess is you're simply generating numbers too large for PHP to handle? 321^321 = 321 * 321 * 321 * 321...[317 more times!], and just 321^4 = 10,617,447,681.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
It might simply be that you need to use bc*() functions for all arithmetic operations, not just the bcpow(). Otherwise you'll be exceeding the max PHP integer size (32 or 64 bit unsigned integer).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks