pete-3.c is one of the nine entries an anonymous "Pete" submitted to Bignum Bakeoff,[1] and the smallest entry that produces a large number. It uses the left shift operator <<, which in the fictional Bignum Bakeoff machine may be defined as \(a \ll b = a \cdot 2^b\) for nonnegative \(a\) and \(b\). (Its behavior is more complex in standard C implementations.)
Presumably to save space, Pete did not use parentheses. Unfortunately, << is left-associative, and \(a \ll b\) grows much faster relative to \(b\) than to \(a\).[2] So the returned value becomes \(9 \cdot (2^9)^{163} \cdot 2^{99} \approx 2.33 \cdot 10^{472}\), between a centillion and googolding. A large amount of space is therefore wasted on a number smaller than 1 << 1,600. If the operator was instead right-to-left associative, the output would grow at a roughly tetrational rate with respect to the number of 9's.
The full decimal expansion of this number is:
Its prime factorization is 21,566 × 32.
Code[]
int main() { return 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 99; }
Approximations[]
Notation | Lower bound | Upper bound |
---|---|---|
Scientific notation | \(2.329\times10^{472}\) | \(2.33\times10^{472}\) |
Arrow notation | \(42\uparrow291\) | \(218\uparrow202\) |
Steinhaus-Moser Notation | 204[3] | 205[3] |
Copy notation | 2[473] | 3[473] |
Taro's multivariable Ackermann function | A(3,1566) | A(3,1567) |
Pound-Star Notation | #*((4918))*13 | #*((4919))*13 |
BEAF | {42,291} | {218,202} |
Hyper-E notation | E[42]291 | E[218]202 |
Bashicu matrix system | (0)(0)(0)(0)(0)(0)(0)[4901] | (0)(0)(0)(0)(0)(0)(0)[4902] |
Hyperfactorial array notation | 241! | 242! |
Fast-growing hierarchy | \(f_2(1558)\) | \(f_2(1559)\) |
Hardy hierarchy | \(H_{\omega^2}(1558)\) | \(H_{\omega^2}(1559)\) |
Slow-growing hierarchy | \(g_{\omega^{\omega^3+\omega+3}+\omega^{\omega^3+\omega+2}}(8)\) |
Sources[]
See also[]
Bignum Bakeoff contestants: pete-3.c · pete-9.c · pete-8.c · harper.c · ioannis.c · chan-2.c · chan-3.c · pete-4.c · chan.c · pete-5.c · pete-6.c · pete-7.c · marxen.c · loader.c
Channel systems: lossy channel system · priority channel system
Concepts: Recursion