Largest number in ten bytes of code

77

11

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.

Ypnypn

Posted 11 years ago

Reputation: 10 485

6Exponentiation 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. – Reinstate Monica – 10 years ago

1It would be fun to see this for each of 1..10 bytes. – None – 9 years ago

what about Aceto, where you can do: 9pppppppppppppppp (9 pushes 9 on the stack, and p prints out 9('0'*p)s – FantaC – 8 years ago

@Dennis It's not an estimate, it's an exact result, but it's a trivial conversion from Ackermann to arrow notation, like taking a square root and turning it into a negative exponent. Literally, ack(m,n) = 2 ↑ ⁽ᵐ⁻²⁾ (n+3) - 3 – user0721090601 – 6 years ago

21What 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 – user80551 – 11 years ago

@user80551 I clarified what I meant by "any". – Ypnypn – 11 years ago

@MadTux None of the top answers on those questions are valid here, since they either take millions of years to run, or are way longer than 10 characters. – Ypnypn – 11 years ago

1Do imports count to the 10 char limit too? – chill0r – 11 years ago

I've voted to close as "Too broad", for reasons which will be obvious if you read the answers to the first question linked by MadTux above. – Peter Taylor – 11 years ago

2@PeterTaylor Well, it is getting all sorts of entertaining answers, and the 10-character limit makes things interesting, so I'm beginning to like it. – MadTux – 11 years ago

4Does bit-shift count as an exponentiation operator since it is equivalent to * 2^x ? – Claudiu – 11 years ago

@PeterTaylor: This is far less broad than that, though. There is actually a scoring criterion (the number), a program criterion (<= 10 chars), and a time limit (< 1 hour running time) – Claudiu – 11 years ago

1@Claudiu: "the output may be in any format" – Peter Taylor – 11 years ago

14The 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 – David Z – 11 years ago

4@DavidZ: True. I'd like to see it changed to "1 hour on X computer", and also clarify the rules as to bit-shift, and whether other large built-in functions (e.g. ack in Wolfram) are allowed. I guess not the best question, but I enjoyed playing to the spirit of the rules – Claudiu – 11 years ago

3As I see it, the problem with ack as used in the current Wolfram answers is that it doesn't calculate the result, it just estimates it. – Dennis – 11 years ago

Are importing the libraries is counted as a code? – kenorb – 11 years ago

So you want the longest number possible in 10 bytes but not the largest number possible? – Anonymous Penguin – 11 years ago

I don't like the rules. I could have posted this last [1..]. It extracts the last element of an infinite list. – gxtaillon – 11 years ago

@Ypnypn One of the rules currently says, "you may not use scientific notation to enter a number". The rules appear to barely leave open the possibility for our code to use scientific notation inside a string literal. Is that so? I suppose eval("9e9") still isn't quite as large as 9999999999. – Keen – 11 years ago

Answers

26

Wolfram Language

ack(9!,9!)

ack(9!,9!) = enter image description here

Output is in Arrow Notation.

Adam Speight

Posted 11 years ago

Reputation: 1 234

26ack(99!,9) is much, much larger. – jimmy23013 – 11 years ago

I think 9! !~ack~9 should also work. But I can't test it in WolframAlpha. – jimmy23013 – 11 years ago

2Does it complete within an hour? Can we actually use Arrow notation as the output? – justhalf – 11 years ago

11One of the other answers says that ack(4,2) is the largest he can calculate in an hour so I would be surprised if this did... – Jerry Jeremiah – 10 years ago

2What happened to the time limit?! – Simply Beautiful Art – 8 years ago

1I'm not sure I'd say it's calculating it. Trying doing ack(9!,9!) + 1 and watch it not even know what's going on — if it were at least keeping things in a symbolic representation, it'd be able to show something. This is basically equivalent to a google search. – user0721090601 – 6 years ago

This goes against the rule that says you can't get it from the Web. – Kyle Kanos – 11 years ago

@KyleKanos It doesn't my interpreter happens to be on the web. Like some other REPLs. – Adam Speight – 11 years ago

Not sure how that's different. Web access is web access, and it's not allowed as per the rules. – Kyle Kanos – 11 years ago

3

@KyleKanos Its different because the code/program isn't calling out to the web. Other Examples http://www.typescriptlang.org/Playground http://www.tryfsharp.org/Learn/getting-started

– Adam Speight – 11 years ago

Pretend you're on a deserted island in the middle of the Pacific Ocean and no internet (and solar powered laptop), can you say definitively that this code of yours will work on your laptop? If yes, then it passes the test & I'm wrong; if no (the case here), then it fails the test & you're wrong. – Kyle Kanos – 11 years ago

2@KyleKanos You're changing the rules of the challenge. Where does it say your on a desert island? Does my Laptop have Mathematica. Do I have a raspberry PI? – Adam Speight – 11 years ago

It says "no Web access" pretty clearly; your answer says WolframAlpha (a website) explicitly. No further discussion is necessary. – Kyle Kanos – 11 years ago

@KyleKanos It doesn't say "no Web access" any where in the challenge. – Adam Speight – 11 years ago

Please read the 2nd bullet point carefully. See also this answer on loopholes that are not funny.

– Kyle Kanos – 11 years ago

35The Wolfram Language is available to use an Raspberry Pi and doesn't require web access. So isn't in violation of that rule. – Adam Speight – 11 years ago

6I think it is very valid answer. Stupid reasoning for being on island and having no access to internet. 'No web' requirement is only to prevent printing output from a already available resource. All answers are valid as long as they 'run' a piece of code to calculate the output. Latest Visual Studio is coming that runs your code on the Azure cloud, so you want to restrict C#? Or you are ineligible if you have chromebook? – microbian – 11 years ago

120

Perl, >1.96835797883262e+18

time*time

Might not be the largest answer... today! But wait enough millennia and it will be!


Edit:

To address some of the comments, by "enough millenia," I do in fact mean n100s of years.

To be fair, if the big freeze/heat death of the universe is how the universe will end (estimated to occur ~10100 years), the "final" value would be ~10214, which is certainly much less than some of the other responses (though, "random quantum fluctuations or quantum tunneling can produce another Big Bang in 101056 years"). If we take a more optimistic approach (e.g. a cyclic or multiverse model), then time will go on infinitely, and so some day in some universe, on some high-bit architecture, the answer would exceed some of the others.

On the other hand, as pointed out, time is indeed limited by the size of integer/long, so in reality something like ~0 would always produce a larger number than time (i.e. the max time supported by the architecture).

This wasn't the most serious answer, but I hope you guys enjoyed it!

Allen G

Posted 11 years ago

Reputation: 1 825

Eventually when the big freeze occurs this answer won't be so relevant anymore – G B – 9 years ago

23Upvoted because I like the eventuality – Tim – 11 years ago

5Won't time wrap around and return a small number at some point? Depends on whether it's 32-bit or 64-bit perl I guess – Claudiu – 11 years ago

@AllenG: Where does perl get the data source for time from? If it's from the system which uses unsigned ints, then it will wrap around. – Claudiu – 11 years ago

Right, I misinterpreted the comment. Well, hopefully by the time the universe is ready, computers/Perl will have increased the size of their integers :). – Allen G – 11 years ago

Wait, reading the clock doesn't count as an input? We can do that? I guess I'll exploit it after all. – Keen – 11 years ago

31000 years ~ 3e10 seconds, so you'll still be hovering around 1e21 as your output. Perhaps if you waited 1e50 years, you might start competing against the other answers? – Kyle Kanos – 11 years ago

That’s only 9 characters, why not time**time? – Timwi – 11 years ago

@Timwi : Exponentiation operators not allowed – Zaid – 11 years ago

8Do you pronounce this "time times time"? :-) (hi Timwi!) – Pierre Arlaud – 11 years ago

1Is the time on death heat of the universe accounting for daylight savings? You could earn a few more seconds of existence. – Alpha – 11 years ago

65

Wolfram ≅ 2.003529930 × 1019728

Yes, it's a language! It drives the back-end of the popular Wolfram Alpha site. It's the only language I found where the Ackermann function is built-in and abbreviated to less than 6 characters.

In eight characters:

$ ack(4,2)

200352993...719156733

Or ≅ 2.003529930 × 1019728

ack(4,3), ack(5,2) etc. are much larger, but too large. ack(4,2) is probably the largest Ackermann number than can be completely calculated in under an hour.

Larger numbers are rendered in symbolic form, e.g.:

$ ack(4,3)

2↑²6 - 3 // using Knuth's up-arrow notation

The rules say any output format is allowed, so this might be valid. This is greater than 101019727, which is larger than any of the other entries here except for the repeated factorial.

However,

$ ack(9,9)

2↑⁷12 - 3

is larger than the repeated factorial. The largest number I can get in ten characters is:

$ ack(99,99)

2↑⁹⁷102 - 3

This is insanely huge, the Universe isn't big enough to represent a significant portion of its digits, even if you took repeated logs of the number.

user15259

Posted 11 years ago

Reputation:

1The only problem with this language is that it melts at 3695 degrees Kelvin. – Wossname – 8 years ago

Why does the exponent look weird? Is it 10 ^ 19278 or something else? – Claudiu – 11 years ago

85Not bad, but it's no match for my ack(4,2)+1 solution. – user19057 – 11 years ago

13ack(4,2)+2, I WIN – None – 11 years ago

Is the source available for the Wolfram language? – Kyle Kanos – 11 years ago

@Claudiu - Superscripts 1-3 are in a different UNICODE block from 0,4-9. Automatic font substitution tries to match the fonts but can't always. – None – 11 years ago

@KyleKanos - No, you have to pay for it. It's used in Mathematica, too. – None – 11 years ago

1I think you won. – Anonymous Pi – 11 years ago

1"As large as it is, Graham's number surpasses anything expressible as an Ackermann number." Counter-example: ack(g_64, g_64). BOOM – Cole Johnson – 11 years ago

@ColeJohnson: as far as I know, there is only one meaning of the word 'source' when it comes to programming languages. – Kyle Kanos – 11 years ago

@ColeJohnson: except my question was precise: is the source of the Wolfram language available. It is very hard to misinterpret that to mean something about a calculation. – Kyle Kanos – 11 years ago

@Kyle Well, there's a free interpreter available online. :P – Riking – 11 years ago

@Yimin Mathematica actually makes a server call to WolframAlpha when you do an = line. – Riking – 11 years ago

@Riking: the free one online is not allowed for this competition though. – Kyle Kanos – 11 years ago

1@ColeJohnson That's like saying you can express g_64 using addition, and then saying g_64+0! Boom! The reasoning is ultimately circular. – Cruncher – 11 years ago

20@Kyle, Yimin There are lots of misleading statements in this post and the comments under it. This is not the Wolfram Language, and not what's used as the backend of W|A. It is simply "natural language" input to Wolfram|Alpha. In the Wolfram Language ack(4,2) is invalid input. W|A's natural language input shouldn't even count as a programming language. It is not Turing complete, and you can't write even basic programs in it such as Euclid's algorithm. For this reason I don't think this is a valid answer any more than a Google query would be. – Szabolcs – 11 years ago

4

The Wolfram Language is the programming language used in Mathematica, documented here. Wolfram|Alpha takes natural language as input, not the Wolfram Language.

– Szabolcs – 11 years ago

@Cruncher except that you can. Graham's number is a computable number unlike Chaitlin's constant (which is an uncomputable number). How about a googolplex (10^googol)? It's a computable number, but it's so massive we won't be able to store it. Computability of a number isn't based off how big it is. Graham's number is orders of magnitude larger than a googolplex, but it's still computable. As such, I can use it in numerical formula calculations. – Cole Johnson – 11 years ago

@ColeJohnson Expressible and Computable are two very different concepts – Cruncher – 11 years ago

@Cruncher from the question: "Your program must calculate a single number..." As in computable numbers. I really don't get what your getting at. – Cole Johnson – 11 years ago

1@ColeJohnson not even really talking about the question. Just responding to "Counter-example: ack(g_64, g_64). BOOM" which was in response to "As large as it is, Graham's number surpasses anything expressible as an Ackermann number." – Cruncher – 11 years ago

@Cruncher and I'm saying that if your Ackermann number is generated with Graham's number in both arguments, it will be bigger than Graham's number. i.e. A[g_64, g_64] > g_64 – Cole Johnson – 11 years ago

30

Python2 shell, 3,010,301 digits

9<<9999999

Calculating the length: Python will append a "L" to these long numbers, so it reports 1 character more than the result has digits.

>>> len(repr( 9<<9999999 ))
3010302

First and last 20 digits:

40724177878623601356... ...96980669011241992192

user19214

Posted 11 years ago

Reputation:

2Darn it! This showed up whilst I was writing the same answer – James_pic – 11 years ago

2That's really just 9 * 2**9999999, so one could argue it uses exponentiation. – Dennis – 11 years ago

2Wait, ***built-in*** exponentiation functions are not allowed so this might slip under the rules. +1 – user80551 – 11 years ago

1

Mathematical way of computing the length: floor(log10(9 * 2**9999999))+1

– Justin – 11 years ago

@Quincunx: Yes... because showing the length is no proof for really having calculated the number I added 40 digits of it. If needed I can add a shasum or something similar too... – None – 11 years ago

@Quincunx It does calculate it, but printing would take a long time. Actually, I couldn't get to make it a string on my machine. See http://pastebin.com/PDTc28P3

– user80551 – 11 years ago

It's pretty slow in CPython, but in PyPy it should calculate in a few minutes. If you just want to verify the length, it's quicker to calculate floor(log10(9) + log10(2) * 9999999) + 1. – James_pic – 11 years ago

89<<(9<<99) is a lot bigger, if it terminates. – Keith Randall – 11 years ago

@KeithRandall: Yes! I am playing with it already. Or to be mor precise: Waiting. Calculating this terminates relatively quickly... try printing it in hexadecimal instead of decimal, that's a lot faster and gives a number of more than 280megabytes of "hex-digits". If I get it printed in decimal I'll mention it here. More than 9<<27 as argument to << is rejected by python. Maybe some other language will accept more there... :-( – None – 11 years ago

Got no luck with 9<<(9<<99) up to now: sdf.org rebooted while my calculation was running (nice 19, I wasn't mean!) and on sdfeu.org it got a kill signal after lots of hours, maybe piping the output into xz -9e >outfile was failing (xz -9e may have been too much of a RAM hog?). I've one more job running on an old notebook (I'm on the road with not much cpu-power)... patience... ommmmmmmmmmmmm... ;-) – None – 11 years ago

@yeti It sounds like you are basically describing my answer, http://codegolf.stackexchange.com/questions/31695/largest-number-in-ten-bytes-of-code/31756#31756

– isaacg – 11 years ago

1@isaacg: (a): I am trying to get it printed in decumal because printing in hex is no big deal. And (b): I have no Python3 at hand right now, so i'm stuck with 9<<27 as maximum argument to 9<<X. So don't worry: It is different from your answer in two aspects! At least until weekend... when I'm back in my home compouting center, things will look different... mwhuaahahaahahahahahahahahahhahahahahahaaaaa! – None – 11 years ago

29

CJam, 2 × 10268,435,457

A28{_*}*K*

This computes b, defined as follows:

  • a0 = 10

  • an = an - 12

  • b = 20 × a28

$ time cjam <(echo 'A28{_*}*K*') | wc -c
Real    2573.28
User    2638.07
Sys     9.46
268435458

Background

This follows the same idea as Claudiu's answer, but it isn't based on it. I had a similar idea which I posted just a few minutes after he posted his, but I discarded it since it didn't come anywhere near the time limit.

However, aditsu's suggestion to upgrade to Java 8 and my idea of using powers of 10 allowed CJam to calculate numbers beyond the reach of GolfScript, which seems to be due to some bugs/limitations of Ruby's Bignum.

How it works

A    " Push 10.                                                          ";
28{  " Do the following 28 times:                                        ";
  _* " Duplicate the integer on the stack and multiply it with its copy. ";
}*   "                                                                   ";
K*   " Multiply the result by 20.                                        ";

CJam, ≈ 8.1 × 101,826,751

KK,{)*_*}/

Takes less than five minutes on my machine, so there's still room for improvement.

This computes a20, defined as follows:

  • a0 = 20

  • an = (n × an - 1)2

How it works

KK,   " Push 20 [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ]. ";
{     " For each integer in the array:                                 ";
  )*  " Increment it and compute the its product with the accumulator. ";
  _*  " Multiply the result with itself.                               ";
}/

Dennis

Posted 11 years ago

Reputation: 196 637

21Haha, is that Kirby? :) – aditsu quit because SE is EVIL – 11 years ago

Could you describe what this is doing? – Kyle Kanos – 11 years ago

2FYI, I ran some tests to check BigInteger performance - I calculated 100000! and converted to string. Results: java 6: 21 sec calculation, 44 sec toString; java 7: 14 sec calculation, 42 sec toString; java 8: 5 sec calculation, 1 sec toString! – aditsu quit because SE is EVIL – 11 years ago

1@aditsu: Upgrading Java reduced the runtime from 5 minutes to 2 seconds! – Dennis – 11 years ago

20

Python 3, 9*2^(7*2^33) > 10^18,100,795,813

9*2^(2^35) > 10^10,343,311,894

Edit: My new answer is:

9<<(7<<33)

Old answer, for posterity:

9<<(1<<35)

Ten characters exactly.

I am printing the number in hex, and

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.

Therefore, my actual code is:

print(hex(9<<(7<<33)))

Proof that it runs in the specified time and generates a number of the specified size:

time python bignum.py > bignumoutput.py

real    10m6.606s
user    1m19.183s
sys    0m59.171s
wc -c bignumoutput.py 
15032385541 bignumoutput.py

My number > 10^(15032385538*log(16)) > 10^18100795813

3 less hex digits than the above wc printout because of the initial 0x9.

Python 3 is necessary because in python 2, 7<<33 would be a long, and << doesn't take longs as inputs.

I can't use 9<<(1<<36) instead because:

Traceback (most recent call last):
  File "bignum.py", line 1, in <module>
    print(hex(9<<(1<<36)))
MemoryError

Thus, this is the largest possible number of the form a<<(b<<cd) printable on my computer.

In all likelihood, the fastest machine in the world has more memory than I do, so my alternate answer is:

9<<(9<<99)

9*2^(9*2^99) > 10^(1.7172038461*10^30)

However, my current answer is the largest anyone has submitted, so it's probably good enough. Also, this is all assuming bit-shifting is allowable. It appears to be, from the other answers using it.

isaacg

Posted 11 years ago

Reputation: 39 268

Your alternate answer requires juuuuust less than 1 MiYiB of memory, and requires 100 bits of addressable memory (so it won't work until at least 128-bit Python). (Source: my similar answer)

– wizzwizz4 – 9 years ago

So far this looks to be the largest answer by far. It's a 10,000,000,000 digit number, after all. – nneonneo – 11 years ago

1@nneonneo : I believe my solution is larger :) – Zaid – 11 years ago

19

Any language with short enough constant names, 18 digits approx.

99/sin(PI)

I would post this as a PHP answer but sadly M_PI makes this just a little too long! But PHP yields 8.0839634798317E+17 for this. Basically, it abuses the lack of absolute precision in PI :p

Niet the Dark Absol

Posted 11 years ago

Reputation: 647

You can do this in Clip v4 or higher (though I can't find an interpreter for any such version) with only 6 chars: /99.sP.

– bcsb1001 – 11 years ago

This reminds me of a time I took a series that involved tan(pi/2) or something similar in Wolfram. When the calculations get rough, Wolfram approximates, and it has very long approximations of pi handy. – Simply Beautiful Art – 8 years ago

@bcsb1001 then I suppose that can be boosted higher – user64742 – 8 years ago

PHP_INT_MAX sadly is 11 chars – ArtisticPhoenix – 8 years ago

PHP_INT_MAX = 9223372036854775807 – ArtisticPhoenix – 8 years ago

sin(pi)^-9 = 1.6081E+143 – Engineer Toast – 6 years ago

1Can't you do tan(PI/2)? – user80551 – 11 years ago

1@user80551 Could do, but I just noticed that I could make use of that last remaining character in the limit to boost my result by 99 times. – Niet the Dark Absol – 11 years ago

Too long in Common Lisp: (/ 99(sin pi)) (14 characters). Error in TI-83: 99/sin(π (8 characters) causes division by zero. Works in LibreOffice Calc: =99/SIN(PI( (10 characters, not counting =) computes 808423047055000000. LibreOffice auto-inserts the last two )) in =99/SIN(PI()). – kernigh – 11 years ago

It's depending on the precision of the language. In PHP 14 decimal digits is a common value. – kenorb – 11 years ago

@kernigh It doesn't matter in this case, but would 99/sin(π be five bytes or eight? I know TI-BASIC stores a bunch of commands as single bytes; is sin( one of them? – wchargin – 11 years ago

@WChargin sin( acts like one character, but I know not many bytes. See http://meta.codegolf.stackexchange.com/questions/1541/how-to-score-ti-basic

– kernigh – 11 years ago

16

Haskell

Without any tricks:

main = print -- Necessary to print anything
    $9999*9999 -- 999890001

Arguably without calculating anything:

main = print
    $floor$1/0 -- 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

Adapting Niet's answer:

main = print
    $99/sin pi -- 8.083963479831708e17

Taylor Fausak

Posted 11 years ago

Reputation: 761

Why do you include $ in the code? – CalculatorFeline – 9 years ago

@CatsAreFluffy without the $ I would have to use parentheses for grouping, which would take an extra character. So my first answer could only have been main=print(9999*999). See http://stackoverflow.com/questions/19521246/what-does-mean-do-in-haskell for more about $ in Haskell.

– Taylor Fausak – 9 years ago

Can't $ be included in the print boilerplate? – CalculatorFeline – 9 years ago

No. It's not necessary to "print anything". You can do main=print"hello" without the $ or parentheses. – Taylor Fausak – 9 years ago

And why is $floor$0/0 so big? Even bigger than everything here, as far as magnitude. – Simply Beautiful Art – 8 years ago

I like the 1/0 trick. Nice and big! – dfeuer – 7 years ago

$cosh 710 is good for 1.1169973830808557e308, if we eschew the exponential definition in favor of the more fundamental geometric definition. – Khuldraeseth na'Barya – 6 years ago

Third bullet says "Your program must calculate..." – user80551 – 11 years ago

8floor(infinity) is a finite number? What the heck Haskell? – nneonneo – 11 years ago

31/0 != infinity, it's undefined. – RubberDuck – 11 years ago

1

Are you sure about that, @ckuhn203? In both GHC 7.6.3 and 7.8.2, I get isInfinite $ 1 / 0 -- True. As far as I can tell, IEEE 754 defines 1 / 0 as infinity.

– Taylor Fausak – 11 years ago

I'm absolutely positive about it @TaylorFausak. Just because IEEE defined it that way, doesn't make it true. See this answer on Math Exchange.

– RubberDuck – 11 years ago

2Oh, you mean mathematically. I agree completely. But as far as programming with IEEE floating point (and Haskell in particular) is concerned, 1 / 0 == Infinity. – Taylor Fausak – 11 years ago

@ckuhn203 The IEEE convention is correct in the sense that the reciprocal of any sequence that tends to 0 tends to infinity. – jub0bs – 11 years ago

15

Powershell - 1.12947668480335E+42

99PB*9E9PB

Multiplies 99 Pebibytes times 9,000,000,000 Pebibytes.

Rynant

Posted 11 years ago

Reputation: 2 353

1+"1"*309 outputs 1.1111e308 though I suppose this breaks the spirit, if not the word of the rule on printing characters. It's cast to a double for output. – tomkandy – 10 years ago

Unfortunately you can't use 9E9. – Erik the Outgolfer – 8 years ago

798901 sq petabytes? Is that some sort of method to measure the surface bit density of (future high-capacity)hard-disks? – user80551 – 11 years ago

Oh, nice. Didn't know pebibytes were possible by now. I always thought it stopped at tebibytes. – Joey – 11 years ago

@Joey Now if MS would only hurry up and add yobibytes, the answer could be even better. – Rynant – 11 years ago

1

I could add that to Pash if it helps ... ;-)

– Joey – 11 years ago

14

J (((((((((9)!)!)!)!)!)!)!)!)

Yeah, that's a lot. 10^(10^(10^(10^(10^(10^(10^(10^6.269498812196425))))))) to be not very exact.

!!!!!!!!9x

ɐɔıʇǝɥʇuʎs

Posted 11 years ago

Reputation: 4 449

Can't that be mathematically expressed as 9!!!!!!!!? – seequ – 11 years ago

@TheRare afaik 9!! = 97531, whereas (9!)! is a lot more! – Flonk – 11 years ago

@Flonk Really? My calculator says 9!! = 362880!. – seequ – 11 years ago

@TheRare http://www.wolframalpha.com/input/?i=9%21%21

– ɐɔıʇǝɥʇuʎs – 11 years ago

@TheRare it's called the double factorial! I think !! is a weird choice for a mathematical operator aswell, but that's how it is.. http://en.wikipedia.org/wiki/Double_factorial

– Flonk – 11 years ago

@Synthetica As my studies in J are... incomplete, what does the x do? – seequ – 11 years ago

@TheRare It uses arbitrary precision integers: the 64 bit ones J uses normally would overflow, otherwise this expression would result in _ (infinity) – ɐɔıʇǝɥʇuʎs – 11 years ago

@Flonk Wow, I've never heard about that. – seequ – 11 years ago

@Synthetica Since The output may be in any format , using _ for infinity might be valid. – user80551 – 11 years ago

@user80551 It feels against the spirit of the question. It might be technically valid though. – ɐɔıʇǝɥʇuʎs – 11 years ago

2Does it actually output the number? Is there a free J compiler out there? – Kyle Kanos – 11 years ago

5

I did find a compiler, but after 20 minutes, !!9x hasn't printed anything to screen. I sincerely doubt that !!!!!!!!9x will ever be computed.

– Kyle Kanos – 11 years ago

Does it use built-in exponentiation? If yes, I don't think this example is valid the same as mine. – kenorb – 11 years ago

My previous comment makes a lot of sense since (9!)! is a number that has over 90k digits to it.

– Kyle Kanos – 11 years ago

16"If it takes longer than an hour to run on the fastest computer in the world, it's invalid." Not sure this would be valid since it doesn't run within an hour – Claudiu – 11 years ago

@kenorb: ! is the factorial function, it's straight multiplication. – Kyle Kanos – 11 years ago

11It took 70 minutes, but !!9x finally printed to screen. I'm impressed that it actually computed the value, but it still completely fails bullet 5. – Kyle Kanos – 11 years ago

Considering that ((9!)!)! is about 10^(10^6.269498812196425) digits long, even !!!9x probably will never be printed to a screen. However, the program might end up finishing computing it. @KyleKanos It's likely that the reason why it took so long for !!9x is because it is ~10^6.269497348270999 digits long, so the outputting it takes a lot longer. The program probably finished computing the number long before 70 minutes.

– Justin – 11 years ago

6@Quincunx: Likely true, however the condition for a valid answer is that the program must succeed in output; this answer completely fails that criterion. Sadly, the upvoters have neglected all the comments pointing this out and still upvote it over the CJam & Golfscript answers that are insanely huge and compute in reasonable time. – Kyle Kanos – 11 years ago

1@KyleKanos Not what I meant. I meant to agree with you. I was saying that this program will never be able to print the number, so it was invalid. I presented that it might be able to compute it, but not print it. – Justin – 11 years ago

@Quincunx: I think I skipped the last half of your first sentence :$. – Kyle Kanos – 11 years ago

@KyleKanos 70 minutes is within an order of magnitude for this comp. If you can find someone with a faster computer I'd call that a valid answer. Would it be winning? – curiousdannii – 11 years ago

@curiousdannii: Seeing how there are a few different answers that compute numbers larger than (9!)!~1e1,859,933, I don't think this would win, even if it computed that within the hour requirement. – Kyle Kanos – 11 years ago

2Why use !!!!9x when you can use !^:!9x? You're already tossing out the time restriction, so why not go all out? – algorithmshark – 11 years ago

3Downvoted because it doesn't print out the answer. – isaacg – 11 years ago

14

K/Kona: 8.977649e261 1.774896e308

*/1.6+!170
  • !170 creates a vector of numbers from 0 to 169
  • 1.6+ adds one to each element of the vector & converts to reals (range is 1.6 to 170.6)
  • */ multiplies each element of the array together

If Kona supported quad precision, I could do */9.+!999 and get around 1e2584. Sadly, it doesn't and I'm capped to double precision.


old method

*/9.*9+!99
  • !99 creates a vector of numbers from 0 to 98
  • 9+ adds 9 to each element of the vector (now ranges 9 to 107)
  • 9.* multiplies each element by 9.0 (implicitly converting to reals, so 81.0 through 963.0)
  • */ multiplies each element of the vector together

Kyle Kanos

Posted 11 years ago

Reputation: 4 270

14

HTML, 9999999999

9999999999

.. nailed it.

The random guy

Posted 11 years ago

Reputation: 1 262

1not a programming language, though. – cat – 9 years ago

1Use PHP, it's better! – CalculatorFeline – 9 years ago

@cat In this case, it's fine, as this is reminiscent of kolmogorov complexity challenges. – Addison Crump – 9 years ago

9&Hat;9999 prints 9^9999. Just sayin :) – Jan – 9 years ago

1saddly PHP_INT_MAX is 11 – ArtisticPhoenix – 8 years ago

11

Python - Varies, up to 13916486568675240 (so far)

Not entirely serious but I thought it would be kinda fun.

print id(len)*99

Out of all the things I tried, len was most consistently getting me large ids.

Yielded 13916486568675240 (17 digits) on my computer and 13842722750490216 (also 17 digits) on this site. I suppose it's possible for this to give you as low as 0, but it could also go higher.

commando

Posted 11 years ago

Reputation: 1 053

Great idea but unfortunately it doesn't calculate anything. – user80551 – 11 years ago

3I do believe the *99 part invokes a calculation. – commando – 11 years ago

Oh yes, /me feels stupid now. – user80551 – 11 years ago

1If you use something shorter - say id(id) or id(0j), you can multiply by 999 – gnibbler – 11 years ago

@gnibbler id(1) works too. – user80551 – 11 years ago

1

Out of smaller named ones in https://docs.python.org/2/library/functions.html , vars consistently gives the highest value(but 4 chars) followed by sum. Use print(sorted([(id(x),x)for x in[id,len,max,min,str,int,ord,chr,sum,map,abs,all,any,bin,bool,eval,oct,vars,iter,list,set,repr,round,zip,type,pow,dict,dir,hex]])[::-1]) to check.

– user80551 – 11 years ago

Why *99? Why not **9? – cjfaure – 11 years ago

@Trimsty, ** is the built in exponent calculation, forbidden by bullet point 1 – SeanC – 11 years ago

10

Golfscript, 1e+33,554,432

10{.*}25*

Computes 10 ^ (2 ^ 25), without using exponents, runs in 96 seconds:

$ time echo "10{.*}25*" | ruby golfscript.rb  > BIG10

real    1m36.733s
user    1m28.101s
sys     0m6.632s
$ wc -c BIG10
 33554434 BIG10
$ head -c 80 BIG10
10000000000000000000000000000000000000000000000000000000000000000000000000000000
$ tail -c 80 BIG10
0000000000000000000000000000000000000000000000000000000000000000000000000000000

It can compute up to 9 ^ (2 ^ 9999), if only given enough time, but incrementing the inner exponent by one makes it take ~triple the time, so the one hour limit will be reached pretty soon.

Explanation:

Using a previous version with the same idea:

8{.*}25*

Breaking it down:

8         # push 8 to the stack
{...}25*  # run the given block 25 times

The stack at the start of each block consists of one number, the current number. This starts off as 8. Then:

.         # duplicate the top of the stack, stack is now | 8 | 8 |
*         # multiply top two numbers, stack is now       | 64 |

So the stack, step by step, looks like this:

8
8 8
64
64 64
4096
4096 4096
16777216
16777216 16777216

... etc. Written in math notation the progression is:

n=0, 8                     = 8^1  = 8^(2^0)
n=1, 8*8                   = 8^2  = 8^(2^1)
n=2, (8^2)*(8^2) = (8^2)^2 = 8^4  = 8^(2^2)
n=3,               (8^4)^2 = 8^8  = 8^(2^3)
n=4,               (8^8)^2 = 8^16 = 8^(2^4)

Claudiu

Posted 11 years ago

Reputation: 3 870

What's the deal with the two one's in front of the 2564 in your output? – Kyle Kanos – 11 years ago

@KyleKanos: That's not my output, it's the output of wc. I'll edit to make it clearer – Claudiu – 11 years ago

you could use wc -c to make the output clearer – daniero – 11 years ago

Nice! I had the same idea a few minutes ago, but it runs much slower with CJam (which is surprising, since it's faster than GolfScript in general). – Dennis – 11 years ago

Isn't that using built-in exponentiation? – None – 11 years ago

@YiminRong: no, it's using multiplication and looping, I just described the answer using ^ to make it more clear what the program was doing – Claudiu – 11 years ago

Could you describe what's going on to those not familiar with Golfscript? :D – Kyle Kanos – 11 years ago

@Dennis It seems that java's BigInteger is pretty slow :( I don't know about ruby, but I tested a python program that calculates a factorial and it was significantly faster – aditsu quit because SE is EVIL – 11 years ago

@KyleKanos: Sure! Updated – Claudiu – 11 years ago

Holy crapola that's awesome. Thanks a lot! – Kyle Kanos – 11 years ago

It should be 30 million digits, not billion. – Dennis – 11 years ago

@Dennis: Oops, I got over-excited. Thanks. – Claudiu – 11 years ago

1Minor improvement: 10{.*}25 delivers 33,554,434 digits and finishes in 90 second on my machine. I don't know why, but 10{.*}26* prints nothing. – Dennis – 11 years ago

@Dennis: Oh interesting, I guess multiply by powers of 10 is way more efficient for whatever reason .. I got 36 seconds for 10^(2^24) – Claudiu – 11 years ago

@Dennis: Interesting I found the same (26* ran for 40 minutes with no output, yet 25 ran in 2 minutes). maybe we found a bug in teh ruby codes – Claudiu – 11 years ago

7

wxMaxima ~3x1049,948 (or 108,565,705,514 )

999*13511!

Output is

269146071053904674084357808139[49888 digits]000000000000000000000000000000

Not sure if it quite fits specs (particularly the output format one), but I can hit even larger:

bfloat(99999999!)

Output is

9.9046265792229937372808210723818b8565705513

That's roughly 108,565,705,514 which is significantly larger than most of the top answers and was computed in about 2 seconds. The bfloat function gives arbitrary precision.

Kyle Kanos

Posted 11 years ago

Reputation: 4 270

6

Haskell, 4950

Aww man, that's not a lot! 10 characters start after the dollar sign.

main=putStr.show$sum[1..99]

Flonk

Posted 11 years ago

Reputation: 7 621

Why not just print? Also, 9/0.000001 is greater than sum[1..99].

– Taylor Fausak – 11 years ago

5At that rate, we might consider 9 999 999 999 to be a lower bound on results. – Keen – 11 years ago

@TaylorFausak This answer is obviously not to be taken seriously! – Flonk – 11 years ago

6

Mathematica, 2.174188391646043*10^20686623745

$MaxNumber

Ten characters exactly.

Michael Stern

Posted 11 years ago

Reputation: 3 029

7Is it technically calculating anything, and is it outputting all the digits and not just scientific notation? – None – 11 years ago

@Yimin: The output may be in any format (so you can print 999, 5e+100, etc.) – edc65 – 11 years ago

The value is not set at compile-time, but depends on the particular machine on which the command is run. I think it counts. – Michael Stern – 11 years ago

5

Python shell, 649539 999890001

Beats Haskell, not really a serious answer.

99999*9999

user80551

Posted 11 years ago

Reputation: 2 520

69999999999 is larger, isn't it? – MadTux – 11 years ago

5@MadTux There is an ambiguous restriction to calculate the answer. – user80551 – 11 years ago

1If this answer is correct, then mine 9**9**9**9 is correct either, as it's arithmetic operator (not built-in func). – kenorb – 11 years ago

3@kenorb It's built in *exponentiation* that's not allowed. – user80551 – 11 years ago

5

Wolfram Alpha (does a website count as a language)?

9! ! ! ! !

outputs

10^(10^(10^(10^(10^(6.27...))))

thanks to Cory for the tip that spaces work as well as parens.

gggg

Posted 11 years ago

Reputation: 1 715

I'm pretty sure this is the biggest number in the thread as of my post but Wolfram chokes on comparing it to other numbers, even ((99!)!)! > 4 never returns. – gggg – 11 years ago

This goes against the rule that says you can't get it from the Web. – Kyle Kanos – 11 years ago

1Too many W|A's! – Anonymous Pi – 11 years ago

5I disagree that this breaks the rules. It doesn't "read it from the web" which is against the rules, it does in fact "calculate a single number and print it" which is what is it supposed to to. The fact that the only available interface is a website doesn't mean it can't count as a programming language. – gggg – 11 years ago

1It is a completely valid answer. – microbian – 11 years ago

@gggg Instead, how about 9! ! ! ! !? – Keen – 11 years ago

4

I'd rather post this as a comment above, but apparently I can't since I'm a noob.

Python:

9<<(2<<29)

I'd go with a larger bit shift, but Python seems to want the right operand of a shift to be a non-long integer. I think this gets closer to the theoretical max:

9<<(7<<27)

The only problem with these is that they might not satisfy rule 5.

Lexelby

Posted 11 years ago

Reputation: 41

4

Befunge-93 (1,853,020,188,851,841)

Glad nobody has done Befunge yet (it's my niche), but dammit I can't find any clever trick to increase the number.

9:*:*:*:*.

So it's 9^16.

:*

Basically multiplies the value at the top of the stack with itself. So, value at the top of the stack goes:

9
81
6561
43046721
1853020188851841

and

.

Outputs the final value. I would be interested to see if anybody has any better ideas.

AndoDaan

Posted 11 years ago

Reputation: 2 232

I have a better idea – MildlyMilquetoast – 9 years ago

3

At least Python 3.5.0 (64-bit), more than 10^242944768872896860

print("{:x}".format( 9<<(7<<60) ))

In an ideal world, this would be 9<<(1<<63)-1, but there aren't enough bytes for that. This number is so big that it requires almost 1 EiB of memory to hold it, which is a little bit more than I have on my computer. Luckily, you only need to use around 0.2% of the world's storage space as swap to hold it. The value in binary is 1001 followed by 8070450532247928832 zeros.

If Python comes out for 128-bit machines, the maximum would be 9<<(9<<99), which requires less than 1 MiYiB of memory. This is good, because you'd have enough addressable space left to store the Python interpreter and the operating system.

wizzwizz4

Posted 11 years ago

Reputation: 1 895

"Only 0.2% of the world's storage space" – Benjamin Urquhart – 7 years ago

1@BenjaminUrquhart If you think it's good, why not upvote? – wizzwizz4 – 7 years ago

There's your double upvote ;) – Benjamin Urquhart – 7 years ago

3

Cubix, 9.670457478596419e+147 (non-competing)

****"///**

Non-competing because Cubix is newer than this challenge. You can test it online here, but note that it doesn't actually print the number; you'll have to pause the program after the last two *s are run to see the value on the stack.

How it works

Cubix is a 2-dimensional esolang where the code is wrapped around a cube. This code is exactly equivalent to the following cube net, where . is a no-op:

    * *
    * *
" / / / * * . .
. . . . . . . .
    . .
    . .

Then the code is run, with the instruction pointer (IP) starting on the top-left corner of the leftmost face, facing right. " turns on string mode, where all chars encountered until the next " push their char-codes to the stack. The IP wraps all the way around the code, pushing three /s (47), two *s (42), and two .s (46) to the stack, before exiting string mode again.

Here's where it gets interesting. The first mirror / reflects the IP so it's facing up; it then rotates around the cube, hitting these chars:

           
    * *
  /     *      
  .     .      
    . .

The three *s multiply the top two items on the stack. Now, unlike most stack-based languages where arithmetic operators pop their arguments, Cubix leaves the previous values on the stack. So that means this calculates 46*46 = 2116, 46*2116 = 97336, 2116*97336 = 205962976.

When the IP reaches the / again, it is turned right. It then hits the next mirror and follows this path:

    *  
    *  
    /         .
    .         .
    .  
    .  

The two asterisks multiply the top two items once more. Then the mirror directs the IP right again, and the third mirror repeats the process once more:

      *
      *
      /     .  
      .     .  
      .
      .

Finally, the IP leaves the mirror section heading east. The two finaly asterisks multiply two more times, leaving a result of 9.670457478596419e+147 on the stack. This could be printed with O, but there's no easy way to do that since practically every spot on the cube is already used.

ETHproductions

Posted 11 years ago

Reputation: 47 880

3

Casio fx-350 ES PLUS, approx. 9.999882753E99

Do calculators count?

At 70! the calculator throws error because apparently it has a number range limit -1E100 ~ 1E100

CuttingChipset

Posted 11 years ago

Reputation: 99

I... don't think this counts as a programming language? – Simply Beautiful Art – 6 years ago

Well I guess there's another calculator answer so this is probably fine. – Simply Beautiful Art – 6 years ago

3

Matlab (1.7977e+308)

Matlab stores the value of the largest (double-precision) floating-point number in a variable called realmax. Invoking it in the command window (or at the command line) prints its value:

>> realmax

ans =

  1.7977e+308

jub0bs

Posted 11 years ago

Reputation: 1 422

Since the OP asked to return a calculated value, you should put realmax+1. I tried it for fun and surprise it returns exactly the same number than you have (then I laughed when I realized ... eps(realmax)=1.99584030953472e+292 ). – Hoki – 10 years ago

3

Python, ca. 1.26e1388

9<<(9<<9L)

Gives:

126026689735396303510997749074166929355794746000200933374690887068497279540873057344588851620847941756785436041299246554387020554314993586209922882758661017328592694996553929727854519472712351667110666886882465827559219102188617052626543482184096111723688960246772278895906137468458526847698371976335253039032584064081316325315024075215490091797774136739726784527496550151562519394683964055278594282441271759517280448036277054137000457520739972045586784011500204742714066662771580606558510783929300569401828194357569630085253502717648498118383356859371345327180116960300442655802073660515692068448059163472438726337412639721611668963365329274524683795898803515844109273846119396045513151325096835254352967440214290024900894106148249792936857620252669314267990625341054382109413982209048217613474462366099211988610838771890047771108303025697073942786800963584597671865634957073868371020540520001351340594968828107972114104065730887195267530118107925564666923847891177478488560095588773415349153603883278280369727904581288187557648454461776700257309873313090202541988023337650601111667962042284633452143391122583377206859791047448706336804001357517229485133041918063698840034398827807588137953763403631303885997729562636716061913967514574759718572657335136386433456038688663246414030999145140712475929114601257259572549175515657577056590262761777844800736563321827756835035190363747258466304L

celtschk

Posted 11 years ago

Reputation: 4 650

2

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!

FantaC

Posted 11 years ago

Reputation: 1 425

1actually you can add another * since p is excluded from bytecount – ASCII-only – 7 years ago

2

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.

Ton Hospel

Posted 11 years ago

Reputation: 14 114

2

TI-36 (not 84, 36), 10 bytes, approx. 9.999985426E99

Older calculators can be programmed to an extent as well ;)

69!58.4376

This is very close to the maximum range a TI calculator can display: -1E100<x<1E100

enter image description here

Benjamin Urquhart

Posted 11 years ago

Reputation: 1 262

2

Perl 6, 456,574 digits

[*] 1..ↈ

No TIO because it takes 2 minutes to run.

bb94

Posted 11 years ago

Reputation: 1 831

2

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

EdgyNerd

Posted 11 years ago

Reputation: 1 106

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.

– None – 6 years ago

Oh wow, I was struggling to paste that into TIO, thanks for the better solution :) – EdgyNerd – 6 years ago

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

– EdgyNerd – 6 years ago

Wait nvm, I forgot the | on the first bracket – EdgyNerd – 6 years ago

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 – EdgyNerd – 6 years ago

I am requesting an exponentation operator in Unofficial Keg. – None – 6 years ago

The PR has been merged. Now you can use the operator to represent larger numbers. (at the cost of using more bytes) – None – 6 years ago

2

Scala, 263-1

Poor, poor Scala. Takes at least 8 characters to get a BigInt value, which doesn't leave enough room to actually make it big.

But with only 7 characters of (counted) code, we can print the largest possible positive Long:

print(-1L>>>1)

Dan Getz

Posted 11 years ago

Reputation: 533

2

Brainf**k 256 - 2147483647

>+[<+>+]<.

If you ignore the fact that most compilers & interpreters output data as it's ascii equivalent (be leanient, it is what it is ;) ), this will return the maximum value of the interpreter/compiler's datatype.

On some systems this is just 256, although on some (mine for example), this is the max value of a 32 bit integer, ie 2 147 483 647.

Edit:

-.

Will print the same thing in many fewer characters

ACarter

Posted 11 years ago

Reputation: 131

That second answer will print -1 on interpreters that use signed values for the tape – Benjamin Urquhart – 7 years ago

1

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.

0 '

Posted 11 years ago

Reputation: 3 439

1

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

Skidsdev

Posted 11 years ago

Reputation: 9 656

For all intended purposes, this is approximately a_127 in the exponential factorial.

– Simply Beautiful Art – 8 years ago

1

APL (Dyalog) — largest representable number (only 3 bytes)

This is the minimum reduction of an empty list:

⌊/⍬

 minimum

/ reduction

 empty list

When reducing an empty list, APL will return the identity element of the function used (if known). For minimum reduction of a system without infinities (e.g. ISO APL, to which Dyalog APL adheres), the identity element for minimum is the largest representable number:

Try it online! (IEEE 754 64-bit floating-point)

Try it online! (IEEE 754-2008 128-bit decimal floating-point)

Adám

Posted 11 years ago

Reputation: 37 779

1

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!

sergiol

Posted 11 years ago

Reputation: 3 055

1

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

FantaC

Posted 11 years ago

Reputation: 1 425

1

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.

Draco18s no longer trusts SE

Posted 11 years ago

Reputation: 3 053

1

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)

user0721090601

Posted 11 years ago

Reputation: 928

Wouldn't a bitshift of 1 quadrillion (base 2) be 300 trillion digits (base 10)? – Draco18s no longer trusts SE – 6 years ago

@Draco18s erm yes. Should be 730 quadrillion off of 2.4 quintillion digits (a billion squared nets a quintillion not a quadrillion) – user0721090601 – 6 years ago

I knew one of the two was wrong. I just didn't validate the billion-squared. ;) – Draco18s no longer trusts SE – 6 years ago

@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 – user0721090601 – 6 years ago

1

Keg, 1.85302E+15

It is definitely the worst answer here...

9:*:*:*:*.

user85052

Posted 11 years ago

Reputation:

Got it up to 221533456↑221533456 by using a for loop with the fact that alpha-numeric characters get auto-pushed to the stack

– EdgyNerd – 6 years ago

1

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

Richard Crossley

Posted 11 years ago

Reputation: 351

Is this using scientific notation? – Shaun Bebbers – 6 years ago

1It is 2 raised to the power of 127, so if that is consider "exponentiation" I'll retract. The example above was 9e+99. – Richard Crossley – 6 years ago

Okay my misunderstanding then. – Shaun Bebbers – 6 years ago

1

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

perl -le "print ~0*9999999"

DarkAjax

Posted 11 years ago

Reputation: 669

Your code was the inspiration for my answer.

– Zaid – 11 years ago

1

Python 2.7 - 8794643931199480236 15616093818140822

print hash('zz')

Willem

Posted 11 years ago

Reputation: 1 528

7Um, that's 12 chars. – user80551 – 11 years ago

Ehh valid point @user80551. Guess I was slightly distracted by the footy match on TV :-) – Willem – 11 years ago

1

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.

Keen

Posted 11 years ago

Reputation: 261

1Bit shift operation are limited to 32 bit integers. 60 == 28 used in a shift operation (try in console: [7<<28, 7<<60]) – edc65 – 11 years ago

1

C++ prints 18446744073709551615

#

ULLONG_MAX is 10 characters.

#include <iostream>
#include <limits.h>
using namespace std;
int main()
{
cout<<ULLONG_MAX<<endl;
return 0;
}

bacchusbeale

Posted 11 years ago

Reputation: 1 235

2And what value does that print? – Kyle Kanos – 11 years ago

@KyleKanos Fixed it, thanks – bacchusbeale – 11 years ago

1

TXR:

$ txr -p '(mask 999)'
535754303593133660474212524530000905280702405852766803721875194185175525562468061246
599189407847929063797336458776573412593572642846157810728751889829846429852761096554
990320661140395677219337642394922319490470301292036210344653556258987007434741839952
7286296858625998634149561158533358569939198279680

Kaz

Posted 11 years ago

Reputation: 372

What is this doing? – Gavin S. Yancey – 11 years ago

@g.rocket It makes a bit mask in which bit 999 is set. It takes multiple arguments, e.g (mask 1 2) yields 6. – Kaz – 11 years ago

1

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?

kenorb

Posted 11 years ago

Reputation: 398

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. – aditsu quit because SE is EVIL – 11 years ago

1

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

perl -e 'print ~0*~0*~0, "\n"'

hexcoder

Posted 11 years ago

Reputation: 111

1

Ozone, 9e+90000

(1)n1n1s2

Though it depends on dialect.

user25246

Posted 11 years ago

Reputation: 19

1

><>, 3147440830160257032480100000000 319626579315078487616775634918212890625

Edit:

Seems like I am allowed to exclude the characters needed for printing, the n in this case, so here is an updated version:

':*:*:*:*nÿ

Original answer:

'*:*:*:*n;

Here, ' activates stringmode, and pushes all the following characters to the stack, before wrapping and exiting stringmode. Then it does a multiply-and-copy chain, printing the number, and exits. Of interest here is the ascii value of n 110, and ; 59.

However, if we allow it to terminate with an error, we can abuse the fact that the official interpreter supports Unicode. The title of the question says bytes, but the text says characters, so the following program is just for the fun of it.

'*:*:*:*n

Outputting 1867215243681462552708446358738678532523702556144100000000

Alternatively, to stick to bytes, ÿ at the end gives us 383233022803952503175039062500000000, and that is still nice.

(New "for fun" program ':*:*:*:*n prints 7587624076546380447593767884781979512738274729546264306618287972087303430335365121)

SE - stop firing the good guys

Posted 11 years ago

Reputation: 529

0

SmileBASIC, 8,589,934,592 274,877,906,944

?#RED*#RED

#RED is a constant for the color red (&HFFF80000)

The expression only takes up 9 characters, so I can print it in 10 characters without decreasing the number.

12Me21

Posted 11 years ago

Reputation: 6 110

1You're not allowed to use exponential functions, unfortunately. – wizzwizz4 – 9 years ago

Oh, I can't believe I didn't see that. fixed. – 12Me21 – 9 years ago

Printing doesn't count in the count, so you'd be able to print it anyway. – wizzwizz4 – 9 years ago

I know, but I had 1 byte left over that I couldn't use for anything else – 12Me21 – 9 years ago

0

Befunge-93, ~2.49e+40

"**:*:*:*.

This works by pushing the ASCII values of the program onto the stack and doing a bunch of multiplication.

Unfortunately, this doesn't work in TIO, but it does in this interpreter.

Here is a worse version that actually works in TIO:

"$$**:*:*.

And prints 1152921504606846976. TIO ended up pushing a lot of spaces and 2 zeroes at the end, so I had to get rid of those.

Note that both of these programs print the number forever, because the end command (@) would have taken up a precious byte.

MildlyMilquetoast

Posted 11 years ago

Reputation: 2 907

0

Wolfram

999999999!

Result:

9.90462657922299373728082110506570432171722139002... × 10^8565705513

Eight and a half billion digits!

This is the biggest I could find without using a named function such as "ack()".

Wossname

Posted 11 years ago

Reputation: 221

Why not 9!!!!!!!!!? Based on the accepted answer, I don't think anyone cares about run-time and physical constraints anymore. – Simply Beautiful Art – 8 years ago

Wolfram didn't like it when I put two factorial symbols consecutively, it seemed to be applying a different operation. Try it with 3!! and wolfram returns 3 as the answer instead of 720. A bug in wolfram? Do I win a prize ? :) – Wossname – 8 years ago

Apparently "double factorial" is a thing - but it doesn't do what I'd have expected. https://en.wikipedia.org/wiki/Double_factorial

– Wossname – 8 years ago

See here on how to do the factorials.

– Simply Beautiful Art – 8 years ago

What about ((999!)!)!? I don't know Wolfram, but I expect brackets are supported – Heimdall – 8 years ago

0

PHP , 11 bytes 1.9662705e+77

<?=9**9**9;

jahly

Posted 11 years ago

Reputation: 31

This isn't INF, it's 1.9662705e+77 – Skidsdev – 8 years ago

How come !! Interpreter writes INF as a result – jahly – 8 years ago

because PHP can't handle a number that large (77 digits). Even if the output was actually infinity, see the last point of the spec Infinity is an abstract concept, not a number, so it's not a valid output – Skidsdev – 8 years ago

and it's not INF anyway :D – jahly – 8 years ago

2Except built-in exponentiation functions were explicitly excluded in the question. – Umbrella – 8 years ago

0

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!

FantaC

Posted 11 years ago

Reputation: 1 425

ockquote>

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.

– nonForgivingJesus – 6 years ago

0

PHP, 9 bytes, MAX INT (9223372036854775807)

echo ~0^1<<63;

or

echo -1^1<<63;

Set an int of all bits on (-1) then XOR it with an int of only the first bit on to flip the sign bit.

Umbrella

Posted 11 years ago

Reputation: 867

0

Stacked, 10 bytes ~ 2 × 10273964

17932!:*:*

Try it online! Snippet outputs the length, then the number itself.

This calculates (17932!)4 (without exponentiation) using scientific precision, so only a constant width is perpetuated. The number looks like:

204449781735459736090000000000000000...00000000000000000

This Wolfram|Alpha link shows what the precise calculation would look like.

Conor O'Brien

Posted 11 years ago

Reputation: 36 228

it's currently broken :( – ASCII-only – 7 years ago

0

x86_64 machine language (Linux) ~2.808896e+307

0:       f2 0f 10 05 fa ff ff    movsd  -0x6(%rip),%xmm0        # 2
7:       ff 
8:       c3                      retq   
9:       7f

This moves the IEEE-754 double precision float 7f c3 ff ff ff fa 05 10 to %xmm0 and returns.

Try it online!

ceilingcat

Posted 11 years ago

Reputation: 5 503

0

Javascript (ES6), 4E+30103

9n<<99999n

Uses big integers so actually goes way past what normal integers could reach.

vrugtehagel

Posted 11 years ago

Reputation: 251

0

C (gcc), 9 * 10^4202512

printf("9%.*u",""); or printf("9%0*u","");

Try it online!

The shortest way to print anything in C (afaik) is puts(""); which is 9 bytes
19 - 9 = 10

.* specifies precision which isn't exponentiation

.number

For integer specifiers (d, i, o, u, x, X) − precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0. For e, E and f specifiers − this is the number of digits to be printed after the decimal point. For g and G specifiers − This is the maximum number of significant digits to be printed. For s − this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered. For c type − it has no effect. When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed.

https://www.tutorialspoint.com/c_standard_library/c_function_printf

So you'll get 9 followed by "" digits,(4202512)
the very last ones read from memory as the number to print is not specified,
adding ,0 would prevent memory reading but push it over the 10 byte limit

PrincePolka

Posted 11 years ago

Reputation: 653

0

33, 7,762,279,691,451,941,920

999999axxao

I'm trying to get the language on TIO

About 7.76227969 x 1018

TheOnlyMrCat

Posted 11 years ago

Reputation: 1 079

0

Forth (gforth), 9 bytes, 7 bytes

-1. ud.

Try it online!

Produces: 340282366920938463463374607431768211455

nonForgivingJesus

Posted 11 years ago

Reputation: 129

0

MathGolf, $\approx 1.609 \times 10^{1859933}$

9!!

Try it online!

With MathGolf being a language written in Python, the main issue will be calculating the number in a timely fashion. This program produces its output in about a minute. It might be possible to to $(10!)!$, which would be significantly bigger. However, the approach and the byte-count is still the same.

maxb

Posted 11 years ago

Reputation: 5 754

This isn't valid I'm afraid. # isn't allowed because of the rule "You may use any features of your language, except built-in exponentiation functions." But even if you'd change it to *, I doubt it would be valid due to the rule "If it takes longer than an hour to run on the fastest computer in the world, it's invalid." Creating an array of timestamp!!!! amount of items in under an hour would be quite a feat. – Kevin Cruijssen – 6 years ago

@KevinCruijssen Oh, I should definitely have read the question more thouroughly... I'll think of another approach, and update the answer when I have one. – maxb – 6 years ago

@KevinCruijssen fixed and verified. – maxb – 6 years ago

0

Wolfram Alpha (click)

fib(99999)

= 1.60528...e20898.

madmax1

Posted 11 years ago

Reputation: 164

1

I don't think so. Just because there is a web based REPL doesn't mean it retrieves the answer from the web. Look at http://www.wolfram.com/raspberry-pi/ for a Raspberry Pi based Wolfram Alpha that doesn't need internet access.

– Jerry Jeremiah – 10 years ago

1This goes against the rule that says you can't get it from the Web. – Kyle Kanos – 11 years ago

0

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.

aditsu quit because SE is EVIL

Posted 11 years ago

Reputation: 22 326

Hey, aditsu, did you design CJam? – None – 11 years ago

2@404NotFound yeah, but a lot of it is like GolfScript – aditsu quit because SE is EVIL – 11 years ago

1Cool, 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++ – None – 11 years ago

@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. – aditsu quit because SE is EVIL – 11 years ago

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? – None – 11 years ago

@404NotFound I'm not sure how crucial, but an understanding of the basic formal language theory is definitely important. – aditsu quit because SE is EVIL – 11 years ago

0

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

user80551

Posted 11 years ago

Reputation: 2 520

0

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();
        }
    }
}

Thomas Weller

Posted 11 years ago

Reputation: 1 925

0

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

TobiasR.

Posted 11 years ago

Reputation: 161

99999,m!si should be much larger. – jimmy23013 – 10 years ago

@jimmy23013 but why the si? – TobiasR. – 10 years ago

To remove the leading zero... or just use two more 9s if that is allowed. – jimmy23013 – 10 years ago

@jimmy23013 ty for the hint, i think 9999999,m! could have won this challange (: – TobiasR. – 10 years ago

If my calculation is correct it's only about 10^(8.28*10^65657059). Those numbers from Ackermann functions are much much larger. – jimmy23013 – 10 years ago

Note that m! was added in version 0.6.5, this question is much older. Also see Dennis's CJam answer. – aditsu quit because SE is EVIL – 10 years ago