83
\$\begingroup\$

Your goal is to print (to the standard output) the largest number possible, using just ten characters of code.

  • You may use any features of your language, except built-in exponentiation functions.
    • Similarly, you may not use scientific notation to enter a number. (Thus, no 9e+99.)
  • The program must print the number without any input from the user. Similarly, no reading from other files, or from the Web, and so on.
  • Your program must calculate a single number and print it. You can not print a string, nor can you print the same digit thousands of times.
  • You may exclude from the 10-character limit any code necessary to print anything. For example, in Python 2 which uses the print x syntax, you can use up to 16 characters for your program.
  • The program must actually succeed in the output. If it takes longer than an hour to run on the fastest computer in the world, it's invalid.
  • The output may be in any format (so you can print 999, 5e+100, etc.)
  • Infinity is an abstract concept, not a number. So it's not a valid output.
\$\endgroup\$
23
  • 4
    \$\begingroup\$ Did you look at these two? codegolf.stackexchange.com/questions/185/… codegolf.stackexchange.com/questions/18028/… \$\endgroup\$ – MadTux Jun 13 '14 at 13:35
  • 22
    \$\begingroup\$ What do you exactly mean by "calculate". Also, If it takes longer than an hour to run on any computer in the world, it's invalid. is not objective. I could (theoretically) manufacture a computer that takes an hour to change one T-state \$\endgroup\$ – user80551 Jun 13 '14 at 13:37
  • 4
    \$\begingroup\$ Does bit-shift count as an exponentiation operator since it is equivalent to * 2^x ? \$\endgroup\$ – Claudiu Jun 13 '14 at 16:08
  • 16
    \$\begingroup\$ The fact that the time limit depends on the performance of the fastest computer in the world makes it impossible for us to determine the set of valid answers... I don't really like that \$\endgroup\$ – David Z Jun 13 '14 at 19:45
  • 7
    \$\begingroup\$ Exponentiation functions are not allowed, but ackermann function is allowed? That seems really arbitrary. It remains unclear why a symbolic manipulation is considered "calculating" the number. \$\endgroup\$ – Reinstate Monica Jul 7 '15 at 13:12

73 Answers 73

2
\$\begingroup\$

Braingolf, I don't even know [non-competing]

#~U&^^^^^^

Doesn't work on TIO as I need to get Dennis to pull, but as you can see here, U in Braingolf calculates a range from 1 to the last item on the stack, in this case ~ or 126

Then reduces the entire stack with exponentiation, meaning the stack now contains 1 value which is equal to 126^125^124...^2^1

We'll call this value n from now on.

Then I had some bytes left, so I filled them with some monadic ^ operators.

This means the final output is (((((n^n)^n)^n)^n)^n)

For reference, 126^125 is 3.518180682714907e+262 and (126^125)^124 is ~35000 digits long

\$\endgroup\$
1
2
\$\begingroup\$

Perl, non competing

I'm using this to highlight a little know corner of perl.

Perl can't really compete on this one because it doesn't have builtin bignums (of course you could load a bignum library).

But what everybody knows isn't completely true. One core function actually can handle big numbers.

The pack format w can actually convert any size natural number between base 10 and base 128. The base 128 integer is however represented as string bytes. The bitstring xxxxxxxyyyyyyyzzzzzzz become the bytes: 1xxxxxxx 1yyyyyyy 0zzzzzzz (every byte starts with 1 except the last one). And you can convert such a string to base 10 with unpack. So you can write code like:

unpack w,~A x 4**4 .A

which gives:

17440148077784539048602210552864286760481312243331966651657423831944908597692986131110771184688683631223604950868378426010091037391551287028966465246275171764867964902846884403624214574779667949236313638077978794791039372380746518407204456880869394123452212674801443116750853569815557532270825838757922217314748231826241930826238846175896997055564919425918463307658663171965135057749089077388054942032051553760309927468850847772989423963904144861205988704398838295854027686335454023567793114837657233481456867922127891951274737700618284015425

You can replace the 4**4 by larger values until you feel it takes too long or uses too much memory.

Unfortunately this is way too long for the limit of this challenge, and you can argue that the base 10 result is converted to a string before it becomes the result so the expression doesn't really produce a number. But internally perl really does the needed arithmetic to convert the input to base 10 which I always considered rather neat.

\$\endgroup\$
2
\$\begingroup\$

Perl 6, 456,574 digits

[*] 1..ↈ

No TIO because it takes 2 minutes to run.

\$\endgroup\$
2
\$\begingroup\$

Aceto

kτ\p******u

Prints out

1 * 10846 (2017)

1.1 * 10846 (2018)

1.3 * 10846 (2019)

6.89 * 1013537 (2019)

Explanation

k - makes the stack 'sticky' so that values when popped are only copied,
 not removed
τ - pushes the date on the stack (the year is on the top, 2017 right now...)
\ - escapes the next character (print)
p - (ignored on first go-around)
*
 *
  *
   *        Multiplies top element by second, but stack has one element so it does it by itself
    *
     *
      *
       *
u - reverses instruction pointer direction
       *
      *
     *
    *
   *
  *
 *
*
p - prints
\ - escapes the date
k - makes stack sticky

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ actually you can add another * since p is excluded from bytecount \$\endgroup\$ – ASCII-only Apr 4 '19 at 0:47
2
\$\begingroup\$

Keg, 260144641↑260144641

*:*(:|:*

Surprised I was able to get it this high, probably can be improved

Edit: Improved by A__

How it works

   Pushes 127 to the stack twice, I used 127 since it is the highest number that can be pushed in 1 byte (Note there is two characters there, they're just unprintables)
*    Multiplies them
:*   Squares that
(    Begin a for loop
:|   That will run 260144641 times (since that is the top element of the stack)
:*   That squares the top element of the stack
At the end it will automatically get printed
\$\endgroup\$
7
  • \$\begingroup\$ No, z isn't the largest number possible with 1 byte; 0x7F is. I usually use unprintable characters when I golf in Keg, to represent specific constants. \$\endgroup\$ – user85052 Aug 10 '19 at 12:57
  • \$\begingroup\$ Oh wow, I was struggling to paste that into TIO, thanks for the better solution :) \$\endgroup\$ – EdgyNerd Aug 10 '19 at 13:03
  • \$\begingroup\$ Now that I think about it, I'm pretty sure this is way higher, but I have no clue how to calculate what that would be \$\endgroup\$ – EdgyNerd Aug 10 '19 at 13:18
  • \$\begingroup\$ Wait nvm, I forgot the | on the first bracket \$\endgroup\$ – EdgyNerd Aug 10 '19 at 13:19
  • \$\begingroup\$ If you were using that, you would need to close out the brackets at the end in order to output it, so I don't think it could be higher \$\endgroup\$ – EdgyNerd Aug 10 '19 at 13:25
2
\$\begingroup\$

><>, ~\$4.24 \times 10^{1177545600} \$

'****l(?;n

Try it online!

Outputs the ordinal value of * (42) around 4088700 times. Every loop it only terminates if the length of the stack is higher than multiplying the ordinal values of l(?;n = 108*40*63*59*110 = 1766318400, but since it only pushes 3 elements to the stack each time, this takes a long while.

\$\endgroup\$
2
\$\begingroup\$

05AB1E, \$>1.0111110111×10^{146,337}\$

žmbbbbbbbb

Try it online! This is the only competing one, the alternative breaks rule 5.

žmbbbbbbbb  # full program
         b  # convert...
žm          # 9876543210...
  b         # in binary...
   b        # in binary...
    b       # in binary...
     b      # in binary...
      b     # in binary...
       b    # in binary...
        b   # in binary...
         b  # to binary
            # implicit output

Alternative, \$2^{\left(x+1\right)^7}\left\{\left(\left(\left(…\left(\left(\left(x^x\right)^{^{x^x}}\right)^{^{^{^{x^x}}}}\right)^{^{^{^{^{^{…}}}}}}\right)^{^{^{^{^{^{^{x^x}}}}}}}\right)^{^{^{^{^{^{^{^{^{x^x}}}}}}}}}\right)^{^{^{^{^{^{^{^{^{^{^{x^x}}}}}}}}}}}\right\}\\x=9{,}876{,}543{,}210\$

žmEEEEEEEm

žmEEEEEEEm  # full program
  E         # for N in [0, 1, ...,
žm          # ..., 9876543210...
  E         # ]...
   E        # for N in [0, 1, ...,
žm          # ..., 9876543210...
   E        # ]...
    E       # for N in [0, 1, ...,
žm          # ..., 9876543210...
    E       # ]...
     E      # for N in [0, 1, ...,
žm          # ..., 9876543210...
     E      # ]...
      E     # for N in [0, 1, ...,
žm          # ..., 9876543210...
      E     # ]...
       E    # for N in [0, 1, ...,
žm          # ..., 9876543210...
       E    # ]...
        E   # for N in [0, 1, ...,
žm          # ..., 9876543210...
        E   # ]...
         m  # push...
žm          # 9876543210...
            # (implicit) or top of stack if not first iteration...
         m  # to the power of...
žm          # 9876543210...
            # (implicit) or top of stack if not first iteration
\$\endgroup\$
1
\$\begingroup\$

Perl, 1.84467422290351e+26 (On a 64-bit machine)

perl -le "print ~0*9999999"
\$\endgroup\$
1
  • \$\begingroup\$ Your code was the inspiration for my answer. \$\endgroup\$ – Zaid Jun 15 '14 at 14:25
1
\$\begingroup\$

TXR:

$ txr -p '(mask 999)'
535754303593133660474212524530000905280702405852766803721875194185175525562468061246
599189407847929063797336458776573412593572642846157810728751889829846429852761096554
990320661140395677219337642394922319490470301292036210344653556258987007434741839952
7286296858625998634149561158533358569939198279680
\$\endgroup\$
2
  • \$\begingroup\$ What is this doing? \$\endgroup\$ – Gavin S. Yancey Jun 16 '14 at 0:15
  • \$\begingroup\$ @g.rocket It makes a bit mask in which bit 999 is set. It takes multiple arguments, e.g (mask 1 2) yields 6. \$\endgroup\$ – Kaz Jun 16 '14 at 2:12
1
\$\begingroup\$

C++ prints 18446744073709551615

#

ULLONG_MAX is 10 characters.

#include <iostream>
#include <limits.h>
using namespace std;
int main()
{
cout<<ULLONG_MAX<<endl;
return 0;
}
\$\endgroup\$
2
  • 2
    \$\begingroup\$ And what value does that print? \$\endgroup\$ – Kyle Kanos Jun 14 '14 at 2:15
  • \$\begingroup\$ @KyleKanos Fixed it, thanks \$\endgroup\$ – bacchusbeale Jun 14 '14 at 5:07
1
\$\begingroup\$

Bash / shell

You may exclude from the 10-character limit any code necessary to print anything.

... you can use up to 16 characters for your program.

(6 chars for code + 7 chars for printing = 26 digits) = 6888888 digits

$ seq -s9 999999

This number is bigger, but people may argue that it's in the wrong format.

The output may be in any format (so you can print 999, 5e+100, etc.).

(8 chars for code + 8 chars for printing = 26 digits) = more than 1183888008 digits

$ seq -s9 99999999

It usually takes around a minute to print the number and it contains the scientific representation of it.


Some funny example:

(10 chars = 26 digits)

echo $$$$$$$$$$
2760127601276012760127601

See: What does $$ mean in the shell?

\$\endgroup\$
1
  • \$\begingroup\$ Your program must calculate a single number and print it. You can not print a string, nor can you print the same digit thousands of times. \$\endgroup\$ – aditsu quit because SE is EVIL Jun 14 '14 at 14:55
1
\$\begingroup\$

Python 2.7 - 8794643931199480236 15616093818140822

print hash('zz')
\$\endgroup\$
2
  • 7
    \$\begingroup\$ Um, that's 12 chars. \$\endgroup\$ – user80551 Jun 13 '14 at 19:48
  • \$\begingroup\$ Ehh valid point @user80551. Guess I was slightly distracted by the footy match on TV :-) \$\endgroup\$ – Willem Jun 14 '14 at 6:17
1
\$\begingroup\$

Perl: 6.27710173538668e+57 on cygwin with a Perl 32 bit

perl -e 'print ~0*~0*~0, "\n"'
\$\endgroup\$
1
\$\begingroup\$

Ozone, 9e+90000

(1)n1n1s2

Though it depends on dialect.

\$\endgroup\$
1
\$\begingroup\$

JavaScript, more than 13 003 624 633 896 (but it reads a clock)

9*new Date

Reading from a clock is effectively taking an input. Feels like cheating. However, the technique seems to be well-received in the answers here.

If clocks are not allowed, then:

JavaScript, 186 025 771 008

99*(7<<28)

Trigonometry takes too many bytes (Math.sin, Math.PI).

Bit-shift goes near the integer maximum, then multiplication yields a floating point.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Bit shift operation are limited to 32 bit integers. 60 == 28 used in a shift operation (try in console: [7<<28, 7<<60]) \$\endgroup\$ – edc65 Jun 13 '14 at 23:07
1
\$\begingroup\$

Brain-Flak, 100 (non-competing)

(()@lt99)

Note that this code must be run with the -d flag which adds 3 bytes.

Try it online!

This uses the @lt debug flag in the ruby interpreter. This flag simply adds the following number to the value which is then pushed by the enclosing parentheses.

The enclosing parentheses do not modify the number and are required for it to be printed so they are not counted towards then 10 bytes.

The () adds one to the value and causes the interpreter to recognize the enclosing parentheses as pushing a value (parentheses will only push a value if they enclose non-debug flag Brain-Flak code.

\$\endgroup\$
1
\$\begingroup\$

Tcl, number in the Demo Output because it is very extense (has 30104 digits)

namespace path tcl::mathop
puts [<< 9 99999]

The relevant part is

<< 9 99999

, the rest is boilerplate.

Try it online!

\$\endgroup\$
0
1
\$\begingroup\$

Acc!!, 999999

19*3
Write _
Write _
Write _
Write _
Write _
Write _

As any code necessary to output anything is excluded, all 'Write ' statements are excluded.

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ > Your program must calculate a single number and print it. You can not print a string, nor can you print the same digit thousands of times. \$\endgroup\$ – nonForgivingJesus Aug 10 '19 at 13:50
1
\$\begingroup\$

Pyt, (only 6 bytes)

9!ḞɳƖ*

Try it online!

Link to number

I don't really see any point in getting any bigger than this. Anything else exceeds the runtime limit on TIO

9  pushes 9
!  factorial of 9 (362880)
Ḟ  push xth Fibonacci Number (really big)
ɳ  push 0123456789
₫  reverse ("987654321")
Ɩ  cast to int ("987654321")
*  multiplies
\$\endgroup\$
0
1
\$\begingroup\$

Runic

This answer is only works, if the following things are true:

  1. I implement the Ackermann function using a non stack overflowing implementation.
    • Which I did briefly last night, but removed as there is no useful reason to keep it
    • It did successfully calculate Ack(4,3) over the course of 20-30 seconds, a number with 19729 digits.
  2. If there are no arbitrary execution limits (e.g. TIO's 60 second timeout)
  3. The executing computer has an arbitrary amount of memory to store exceedingly large stacks of BigIntegers

But if given those, then this program...

'ÿY:A:A:A@

...prints a number so large simply calculating how many digits it has is impossible, due to the explosive nature of the Ackermann sequence. Heck the inputs to the first call are both 255000!

The output (and thus input to the next call) is (in Knuth up-arrow notation): 2 ↑254998255003 - 3
(that's 254 BILLION arrows!)

Explanation

>                Implicit entry
 'ÿ              Pushes the character ÿ onto the stack (which will be implicitly converted to an `int`
                    whenever a math operator is called on it).
   Y             Multiply by 1000 (the 'biggest' thing we can apply to a single stack value in 1 byte) 
    :            Duplicate top item on the stack
     A           Pop x and y, call Ack(x,y)
      :          Duplicate top item on the stack
       A         Pop x and y, call Ack(x,y)
        :        Duplicate top item on the stack
         A       Pop x and y, call Ack(x,y)
          @      Print the entire stack, top to bottom (there's only 1 value) and terminate

Larger still?

`AAAAAAAA@

Push the character sequence A,A,A,A,A,A,A,A,@ onto the stack (9 items) as the instruction pointer begins a character sequence on ` and loops around until it sees ` again. Each A then invokes Ack(x,y) (where x is the top of the stack) until the stack contains 1 entry, printing it. Not sure if this is actually larger or not.

However...

The closest we can get by abiding by the limitations is this:

':pba,*@

(Note the non-printing character 0x8F in position 2)

Try it online!

Which prints 1.79657789596691E+308 (143143 * 1.1). The multiplier of 1.1 is the largest that can be applied without rolling over to infinity due to the limits on a double: even multiplying by a9, (1.11) is sufficient to trigger the infinity bit.

\$\endgroup\$
1
\$\begingroup\$

Perl 6, 730 quadrillion digits

9+<now*now

This builds the Perl 5 solution (time*time) and the Javascript (bit shifting). Time is currently around 1.56 billion, so we square it (~2.44 quintillion), and then bitshift 9 (because > 1 ha) a fairly insane number of digits to the right. Perl 6 uses arbitrary precision integers, and that applies to bitshifting as well. Bit shifting in and of itself doesn't take hardly any time at all, it's just a question of memory restraint and the largest super computers ought to have sufficient, but I don't on my puny laptop.

Given 210x ≈ 103x, we can surmise that there should be around some 730 quadrillion digits if I did my math right. Times out on TIO for 9+<$x where $x > 1000000, but handles 100000 in sub 1 secs ao no TIO link. Answer of course will continue to grow exponentially

(if that's considered out of bounds, though, can just make it 9+<now which should still fetch a fairly high number, or any other technique to generate the largest in-bounds number at in 7 digits)

\$\endgroup\$
4
  • \$\begingroup\$ Wouldn't a bitshift of 1 quadrillion (base 2) be 300 trillion digits (base 10)? \$\endgroup\$ – Draco18s no longer trusts SE Jul 28 '19 at 3:56
  • \$\begingroup\$ @Draco18s erm yes. Should be 730 quadrillion off of 2.4 quintillion digits (a billion squared nets a quintillion not a quadrillion) \$\endgroup\$ – user0721090601 Jul 28 '19 at 6:49
  • \$\begingroup\$ I knew one of the two was wrong. I just didn't validate the billion-squared. ;) \$\endgroup\$ – Draco18s no longer trusts SE Jul 28 '19 at 16:36
  • \$\begingroup\$ @Draco18s I blame my lack of coffee at the time lol. In any case, result = "really big", certainly bigger than anything not using a built-in ack() function \$\endgroup\$ – user0721090601 Jul 28 '19 at 18:42
1
\$\begingroup\$

Keg, 1.85302E+15

It is definitely the worst answer here...

9:*:*:*:*.
\$\endgroup\$
1
  • \$\begingroup\$ Got it up to 221533456↑221533456 by using a for loop with the fact that alpha-numeric characters get auto-pushed to the stack \$\endgroup\$ – EdgyNerd Aug 10 '19 at 12:53
1
\$\begingroup\$

BBC BASIC 2

7 bytes

P.2^127

Result

1.70141181E38

BBC BASIC

As commented the previous answer may violate the exponation rule, so here's something using the EXP (exponent) function instead.

P.EXP(88)

which returns

1.65163622E38

BBC BASIC 2

\$\endgroup\$
3
  • \$\begingroup\$ Is this using scientific notation? \$\endgroup\$ – Shaun Bebbers Aug 16 '19 at 14:52
  • 1
    \$\begingroup\$ It is 2 raised to the power of 127, so if that is consider "exponentiation" I'll retract. The example above was 9e+99. \$\endgroup\$ – Richard Crossley Aug 16 '19 at 15:33
  • \$\begingroup\$ Okay my misunderstanding then. \$\endgroup\$ – Shaun Bebbers Aug 20 '19 at 9:20
1
\$\begingroup\$

Binary Lambda Calculus, \$ f_{\omega+2} (2)\$, 9.75 bytes

This program outputs a number larger than Graham's Number while using 78 bits, which is 9.75 bytes, within the 10-byte budget given to me:

010101000001110011101000000101011000000101101101011010000110100000011100111010

If you prefer an ASCII display of the binary number, here it is:

T��mhh:

(Inspired, but not copied, by the entry mentioned here)

How it works:

This Binary Lambda Calculus expression encodes the following expression below:

(\f x.f (f x))(\f n.n (\g m.m g m) f n)(\x.x x)(\f x.f (f x))

This Lambda Calculus expression uses Church Numerals. Church Numerals are generally considered to be the standard representation of natural numbers. What makes Church Numerals powerful is that they are defined using recursion:

[n] f m = f (f (f (...(f m)...))) with n f's.

What this means is that if we have a function \$f\$ and a natural number \$n\$, we can simply concatenate them into \$n f\$ to make a much faster function. You can read the article I linked above if you want to see how Church Numerals can be encoded in Lambda Calculus.

Exponentiation

What is more, Church Numerals can even act on themselves! n m represents \$m^n\$ using exponentiation!

Example: \$2^3\$
(Here, we will apply that to the function f n, to show the true power of recursion)

  • 3 2 f n
  • 2 (2 (2 f)) n
  • (2 (2 f)) ((2 (2 f)) n)
  • (2 f) ((2 f) ((2 f) ((2 f) n)))
  • f (f (f (f (f (f (f (f n)))))))
  • = 8 f n

We can create a function that captures the true power of exponentiation!

\x.x x

When applied to a Church Numeral \$n\$, it returns \$n^n\$. Viola! Let's call our exponential combinator \$E\$, such that:

E = (\x.x x)

Recursion

In order to get beyond exponentiation, we must recurse our \$E\$ combinator. Remember how popping a number before a function recurses it? Well, we can do this with the E combinator, provided that it is a unary function. Define the \$R\$ combinator as followed:

R = (\g. \m.m g m)

Here, how it works is that for a function \$f\$ applied to an number \$n\$, \$Rfn\$ reduces down to \$nfn\$. This is awesome, because Church numerals naturally recurse functions, meaning \$nfn\$ reduces down to \$f (f (f ...(f n)...))\$.

What if we let our function be our exponential combinator \$E\$? \$REn\$ grows tetrationally. But there is no reason to stop here. We can merge \$R\$ and \$E\$ into a single combinator, \$(RE)\$, and recurse that to have \$R(RE)n\$. This grows pentationally.

We can have \$R(R(RE))n\$, \$R(R(R(RE)))n\$, and so on. But notice how the \$R\$ combinator is being recursed over \$E\$. Well, this is where Church Numeral Recursion comes back into play.

Super-Recursion

Define a new combinator, \$S\$, as the following:

S = (\f n.n R f n) = (\f n.n (\g m.m g m) f n)

Cool, now one thing that makes this powerful is that while the \$R\$ combinator recurses over a function \$f\$, the \$S\$ combinator repeatedly applies the \$R\$ combinator to a function \$f\$. Consider this:

$$SE3$$

The first thing that \$S\$ combinator is going to do is to reduce to \$nR\$ where n is the number after the \$E\$. So our reduction will look like this:

$$3RE3$$

The Church Numeral recursion applies on \$R\$ over \$E\$, thus nesting \$R\$ three times, thus giving us this:

$$R(R(RE))3$$

As we seen above, each \$R\$ increases the size of the number considerably, and now the \$S\$ combinator recurses over the \$R\$ combinator! The combinator (SE) grows at \$f_{\omega}\$ in the Fast Growing Hierarchy, about the limit of the Ackermann Function. We can take this a step forward.

  • \$R(SE)\$ recurses over the (SE) combinator, growth rate similar to Graham's Number
  • \$R(R(SE))\$ has \$f_{\omega+2}\$ growth in the fast growing hierarchy
  • \$S(SE)\$ has \$f_{\omega2}\$ growth in the fast growing hierarchy
  • \$S(S(SE))\$ has \$f_{\omega3}\$ growth in the fast growing hierarchy

Similar to how inserting a church numeral before \$R\$ can recurse the recursion function over \$E\$, inserting a church numeral before \$S\$ recurse the super-recursion function over \$E\$. For example, \$2SE\$ = \$S(SE)\$.

The Number:

The number is \$2SE2\$ using Church Numerals and the combinators defined above. This translates to about \$f_{\omega+2} (2)\$ in the Fast Growing Hierarchy, which is greater than Graham's Number. Graham's Number is far greater than even \$Ack(9!,9!)\$ in Wolfram-Alpha. Expanding \$2SE2\$ will yield:

(\f x.f (f x))(\f n.n (\g m.m g m) f n)(\x.x x)(\f x.f (f x))

The lambda expression for \$2\$ is (\f x.f (f x)), as you can see it is a Church Numeral. By decoding this Lambda Calculus Expression in Binary Lambda Calculus, one could expect a 9.75-byte expression:

010101000001110011101000000101011000000101101101011010000110100000011100111010

We proved that we can beat Graham's Number in 10 bytes! Ridiculous?

\$\endgroup\$
1
\$\begingroup\$

Deadfish~, ~~2↑4000

{{{iss}}}o

Crashes TIO, but in theory works.

This means:

Repeat 1000 times: add one, than square twice.

First iteration: 0 => 1 => 1 => 1 Second iteration: 1 => 2 => 4 => 16 Third iteration: 16 => 17 => 289 => 83521 And after this it grows without bound.

\$\endgroup\$
1
\$\begingroup\$

CSASM v2.3, 9222471316929301708

func main:
push 1.9
bits
asl
print
ret
end

Explanation

The minimum code needed to print something in CSASM is as follows:

func main:
push <something>
print
ret
end

Thus, I took the liberty of having the 10-byte limit be on the <something> rather than the entire program, as is mentioned in the challenge:

You may exclude from the 10-character limit any code necessary to print anything.

Otherwise, this language wouldn't be able to even have a submission for this challenge.
(The boilerplate for an empty main function is 16 bytes.)

So, that leaves me with figuring out how to best use those 10 bytes. Hence, I abused one of the instructions in the language: bits

According to the syntax.txt file:

Pops A (an <f32> or <f64>), then pushes an <i32> or <i64> set to the bit representation of A

... where A stands for "the top value on the stack".

In short, a single- or double-precision floating-point value is popped from the stack. The value's bit representation (sign, exponent, mantissa) is then stored into a 32- or 64-bit integer value and that integer value is pushed to the stack.

Why use 1.9?

The bit representation of 1.9 is: $$ 00111111 11111110 01100110 01100110 01100110 01100110 01100110 01100110 $$ This value interpreted as an i64 (or long) would be 4611235658464650854. However, this can be better. Using the last 3 available bytes, we can perform an Arithmetic Shift Left (asl) instruction, to get the following bit representation instead: $$ 01111111 11111100 11001100 11001100 11001100 11001100 11001100 11001100 $$ ... which ends up being 9222471316929301708 instead.

If I were to use any value larger than 1.9 within the limits of the 3 bytes for the number (say, 2.0), the exponent part of the bit representation would be 10000000000 or some larger number.

The MSB in the exponent would get shifted left into the sign bit, resulting in a negative end result. Not good.

Furthermore, if I were to not use the asl instruction and instead opted to use 1.9999, the value would still be smaller than using 1.9 and the asl instruction.

\$\endgroup\$
0
\$\begingroup\$

CJam - 40.4 million digits

1X27m<m<

Assuming bit shift is ok, this calculates 1<<(1<<27). It takes about 15 minutes on my laptop, using java 8 to run the interpreter.

\$\endgroup\$
6
  • \$\begingroup\$ Hey, aditsu, did you design CJam? \$\endgroup\$ – user19785 Jun 14 '14 at 8:57
  • 2
    \$\begingroup\$ @404NotFound yeah, but a lot of it is like GolfScript \$\endgroup\$ – aditsu quit because SE is EVIL Jun 14 '14 at 14:01
  • 1
    \$\begingroup\$ Cool, where did you learn parsing to write an interpreter? I'm really interested in parsing etc., but I'm only 12 (no CS courses ;() I'm currently reading "Parsing Techniques: a Practical Guide" and trying to write my toy compiler in C++ \$\endgroup\$ – user19785 Jun 14 '14 at 17:59
  • \$\begingroup\$ @404NotFound I'm not sure I can answer exactly... my first experience with parsing was probably writing an arithmetic expression evaluator, and I learned that from a book or maybe somebody else's source code. In university I learned something about formal languages - finite automata, formal grammars (of different types) and parsing techniques. Then I read a few things on the net about some other types of parsers, and wrote some code to try things out, but I can't say I learned a lot, and I'm not really good at this. I designed CJam to be easy to parse, something like C++ is MUCH MUCH harder. \$\endgroup\$ – aditsu quit because SE is EVIL Jun 15 '14 at 8:18
  • \$\begingroup\$ Of course I'm not trying to parse C++, I mean I write simple parsers in C++... In retrospect, was the university's class really crucial? Or did it have a more mild effect on your learning? \$\endgroup\$ – user19785 Jun 15 '14 at 9:26
0
\$\begingroup\$

units interactive shell, 3.085369e+68

You read that right, I know it's not much but it's definitely different.

9999Ypc
ym

I'm assuming newline counts as a character and the invocation of units counts as code essential to print. Ypc is yotta parsec, ym is yocto meter.

You have: 9999Ypc
You want: ym
    * 3.085369e+68
    / 3.2411034e-69
\$\endgroup\$
0
\$\begingroup\$

C#: 1.8E+19

Unfortunately we can't bit-shift doubles.

using System;
namespace BigNum10Bytes
{
    class Program
    {
        static void Main()
        {
            // Playing with ulongs 
            Console.WriteLine(ulong.MaxValue);
            Console.WriteLine(~(1UL<<64)); // 10 chars, 18446744073709551614
            Console.WriteLine(8191UL<<51); // 10 chars, 18444492273895866368

            Console.ReadLine();
        }
    }
}
\$\endgroup\$
0
\$\begingroup\$

Cjam - alot

alot:

99999999m!

even more:

9999999,m!

Unfortunately i cant calculate the result. But refering to wikipedia 14842907m! would be 2.788662975×10 ^ 100 000 000

\$\endgroup\$
6
  • \$\begingroup\$ 99999,m!si should be much larger. \$\endgroup\$ – jimmy23013 Jul 7 '15 at 13:09
  • \$\begingroup\$ @jimmy23013 but why the si? \$\endgroup\$ – TobiasR. Jul 7 '15 at 14:03
  • \$\begingroup\$ To remove the leading zero... or just use two more 9s if that is allowed. \$\endgroup\$ – jimmy23013 Jul 7 '15 at 14:04
  • \$\begingroup\$ @jimmy23013 ty for the hint, i think 9999999,m! could have won this challange (: \$\endgroup\$ – TobiasR. Jul 7 '15 at 14:08
  • \$\begingroup\$ If my calculation is correct it's only about 10^(8.28*10^65657059). Those numbers from Ackermann functions are much much larger. \$\endgroup\$ – jimmy23013 Jul 7 '15 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.