Golfscript, 1 -> 2
`
if the requirement is to produce the shortest code with an output longer than input, this is the winner (unless we count error messages of languages where an empty source is invalid program). Backtick means "inspect/uneval". Since the empty string (input) happens to be already present on the stack, this produces a string containing only two double quotes, which is then printed out.
C++, 22 -> 2^31-1 (= 2147483647)
printf("%*i",~0u>>1,0)
It's hard to argue that string concatenation or infinite precision arithmetic doesn't loop internally. In such case, we are restricted to built-in finite precision data types. However, the best place for a large value is the output precision, not the value to be printed. In C++, the variable precision type is int, so we can print with no more than 2^31-1 digits of precision. Sure, the printing routine will loop a bit, but printing routines are allowed to. But, if built in operators (but not library functions) are allowed to loop as well,
J, (extreme growth)
!9
!!9
!!!9
!!!!9
the factorial of an n-digit number has in the order of e^n digits for some small e. This means the sequence factorial of (factorial of(factorial of ... (factorial of 9) ...))) grows very quickly.
It's unclear what "same code twice" exactly means, but I'll assume that two invocations of the same system function are allowed as long as the function itself is allowed. "if you declare procedure it can be called only once"
Of course, if function exponentiation doesn't count as iteration, we can grow much more quickly than that:
!^:(!^:]9)9
this will apply factorial to nine nine times, then use that as the number of applications of factorial to (another) nine. Of course, these can be nested ad lib. Say, we could take the factorial of !^:9]9
!^:9]9
times. We'll also shorten !^:9]9
to just !^:]9
.
!^:]!^:]9
Ninth composition of !^:]
can be shortened to !^:]^:9
. The argument'th composition is !^:]^:]
. Unfortunately, function power cannot be applied to conjunctions like function power, so let's stop here for now (arg compositions of (arg compositions of (arg compositions of ... factorial))):
!^:]^:]^:]^:]
We could apply "eval" here, but we're way so far off the realm of definitely not iterating I better stop here and not get to stuff like string multiplication and evaluation in order to crank up this immense number even higher.
Golfscrcript, n -> theta(2^n)
````````````...
Languages without built-in infinite precision arithmetic can still achieve exponential growth via string concatenation (twofold increase in two characters). Or, we could inspect the inspection of the inspection of ... yielding twofold increase in just a single char.
1->2
meets requirements, but the way you gotn->2^n
doesn't meet requirements. \$\endgroup\$