Big big numbers
Pyth, 252111 ≈ 3.593 × 10266
Js[
"ixL-rC1`H``N"
N
s@L-rC1`H``NjQ252
N
"252")$import sys$$sys.stdout.buffer.write(J.encode('iso-8859-1'))$
Had to use a little bit of Python syntax, because Pyth's print
can't print in iso-8859-1
.
The number gets encoded in base 252 and represent each digit in that base as an iso-8859-1 char. The chars \
and "
would need escaping, and therefore are not used. The char `
isn't used because golfing... And additionally the null-byte is also not used, the Pyth compiler forbids it.
The output is a program with an overhead of 17 bytes:
ixL-rC1`H``N""252
Here's an example usage with the biggest number possible:
Explanation
of the output program.
ixL-rC1`H``N""252
rC1`H create the range of chars: ['\x01', '\x02', ..., '{}']
``N creates a string containing the 3 chars " ' \
- remove strings which consists of these 3 chars
xL "" determine the index of each char in "" (encoded number)
i 252 convert from base 253 to base 10
CJam, 254109 ≈ 1.34 x 10262
q~254b{_33>+_91>+c}%`"{_'[>-_'!>-}%254b"
I'm encoding the number in base 254 and represent each digit in that base as an ISO 8859-1 character, skipping "
and \
. The output has an overhead of 19 bytes, ""{_'[>-_'!>-}%254b
, so I can represent everything less than 254128-19, or explicitly
13392914970384089616967895168962602841770234460440231501234736723328784159136966979592516521814270581662903357791625539571324435618053333498444654631269141250284088221909534717492397543057152353603090337012149759082408143603558512232742912453092885969482645766144
As an example, 6153501
would be encoded as
"abc"{_'[>-_'!>-}%254b
Here is a test program which prints the encoded integer, and then prints its length, and then executes it right away to show its validity (this avoids the trouble of having to copy the unprintable characters into a new program, which doesn't always work with the online interpreter).
Perl, 10216
print"print unpack'h*',q{",(pack'h*',<>),"}"
Also base 100 encoding, slightly more elegant. Output for 12345678
would be:
print unpack'h*',q{!Ce‡}
The delimeters {
and }
correspond to hex values b7
and d7
respectively, which cannot appear in the input, and therefore do not need to be escaped.
There are 20 bytes of overhead, leaving 108 for encoding, reaching a maximum value of 10216-1.
Perl, 10206
print"ord=~print\$' for'",(map chr"1$_",<>=~/.{1,2}/g),"'=~/.|/g"
Simple base 100 encoding. Output for 12345678
would look like this:
ord=~print$' for'p†œ²'=~/.|/g
There are 25 bytes of overhead, leaving 103 for encoding, reaching a maximum value of 10206-1.