Busy beaver of sorts

-4

I'm surprised this hasn't been done yet, but here we go.

Create a program which prints some number of 1s (ideally as large as possible) before halting.

The rules are simple:

Your program is bounded to 50 bytes in size.

Your output must only be a continuous row of 1s (plus trailing newline if it has to be added), without any breaks in the middle.

Your program must halt. No infinite loops.

Your program must not use STDIN or output to STDERR.

Your program must use STDOUT or closest equivalent.

Your score is the amount of 1s your program prints before halting.

Have fun.

Andrew

Posted 2019-10-22T14:55:48.693

Reputation: 2 067

Question was closed 2019-10-25T00:49:53.457

4

Well, there have been many extremely related challenges, with the only significant difference that they didn't arbitrarily demand unary output (https://codegolf.stackexchange.com/questions/18028/largest-number-printable is the first one I can recall; there have been some like "Golf a number bigger than [insert large number name here]")

– my pronoun is monicareinstate – 2019-10-22T15:12:02.057

I was looking to emulate busy beaver Turing machines in this challenge. – Andrew – 2019-10-22T15:13:24.517

Answers

3

Runic Enchantments, Score: Aproximately (10↑↑200) (10↑↑303)18.877

>>>yybbqf:p'!A'!A'!A'!A'!A'!A'!A'!A'!A'!AFm1)b*?*@

Try it online!

Utilizes Stephen's idea of factorials (they're kind of expensive in Runic, so I hadn't considered them originally) and managed to squeeze out two three hundred of them via implicit edge looping. Value-in is 15^15 (437,893,890,380,859,375) and the resulting value is then multiplied against the string 1111 (bbq is just as long as "1" and produces more 1s).

200->300 accomplished by removing flow control logic and simply raising the "skip when true" to jump over the start of the program (executes the :p for bonus length, but is dwarfed by the factorials, but is responsible for the extra 3 powers of 10 in the tower).

"Wolfram|Alpha doesn't understand your query"

Draco18s no longer trusts SE

Posted 2019-10-22T14:55:48.693

Reputation: 3 053

2

Python, 9^9^9^9^9^9^9^9^9^9^9^9^9 (or 9↑↑13)

print("1"*(9**9**9**9**9**9**9**9**9**9**9**9**9))

I hope this is right

Try it online!

Delta

Posted 2019-10-22T14:55:48.693

Reputation: 543

you are right, my bad – Delta – 2019-10-22T15:24:31.530

2

MATLAB, Score: 9↑↑(2↑(10↑313))

x=9;
while(cputime<realmax/2)
x=x^x;
end
ones(1,x)

Try it online!

cputime counts the number of seconds that the MATLAB thread actually runs on the CPU as a double. realmax is the maximum double, ~10^308; I divide by 2 because cputime will rollover back to zero and we actually need the loop to stop. According to the profiler, on my computer MATLAB can run the loop 1e6 times in about 3.7 seconds. That means we'll perform x=x^x about 10^313 times! That isn't just 9↑↑(10↑313), because it compounds on every loop. It's 9↑↑(2↑(10↑313)) I think. I could cheat and make the condition cputime==realmax/2, and then it would be up to random chance when the program finally ends, making an absolutely insane number, but one that can't be calculated.


MATLAB, Score: 9↑↑79 (or about (10↑↑78)8.568)

f=@(x) factorial(x)^x;
ones(1,f(f(f(f(9^9^9^9)))))

Try it online!

Probly not as big as the power tower answers though. I need to figure out a short way to do that here.

HiddenBabel

Posted 2019-10-22T14:55:48.693

Reputation: 603

@Draco18s Sorry I overwrote your edit. Can you figure out about how big this version is? Wolfram stalls out – HiddenBabel – 2019-10-22T17:25:42.363

@Draco18s Nah, the ^x does something. factorial(9^9^9^9)^factorial(9^9^9^9) is already 10||9 https://www.wolframalpha.com/input/?i=factorial%289%5E9%5E9%5E9%29%5Efactorial%289%5E9%5E9%5E9%29

– HiddenBabel – 2019-10-22T18:20:58.693

@Draco18s I'll try to work it out later, with Stirling's approximation or something – HiddenBabel – 2019-10-22T18:30:12.030

Think I figured it out. On some value x↑↑y your lambda f results in (x↑↑(y+1))^(x↑↑y). For some value (x↑↑y)^(x↑↑z) that is equal to x↑↑(y+z). So your answer should have a score of 9↑↑79 (which is a little less than 10↑↑79; (10↑↑78)^8.568). – Draco18s no longer trusts SE – 2019-10-22T19:43:39.210

@Draco18s Nice! Go ahead and edit if you want – HiddenBabel – 2019-10-22T19:57:39.877

1Was definitely one of those "go get lunch and mull over the problem" sort of solutions. I ran through what "10↑↑2 ^ 10↑↑2" meant and then the pattern made sense. – Draco18s no longer trusts SE – 2019-10-22T21:14:37.830

@Draco18s Did I calculate this new one correctly? – HiddenBabel – 2019-10-23T06:45:26.600

@Draco18s I didn't consider the loop will start running slower and slower but whatever – HiddenBabel – 2019-10-23T14:27:31.230

*Shrug* My answer would suffer from bit-overflow (and memory) long before actual termination. Usually with busy-beaver type problems there's an assumption of infinite memory. The loop you have looks like it would have linear execution, so its treated as linear (even as when more and more bits get coopted to store the result it does take longer). (I also cleaned up some no-longer-needed comments) – Draco18s no longer trusts SE – 2019-10-23T14:32:27.183

@Draco18s Ok yeah it should be linear. This isn't BigInteger. But I think I did goof: shouldn't it be 9||(2|(10|313))? It doubles every loop – HiddenBabel – 2019-10-23T15:12:00.360

9↑↑(2↑(10↑313)) would be correct, yeah. – Draco18s no longer trusts SE – 2019-10-23T15:16:07.663

2

cQuents, Aproximately (10↑↑45)7.347

"#t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&1

Try it online!

Note that it does not start printing the 1s until it calculates the result of the factorial, so this probably will not run on any real system.

According to Wolfram Alpha, this value equals

enter image description here

or in plaintext

10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^(10^7.346902562777663))))))))))))))))))))))))))))))))))))))))))))

Stephen

Posted 2019-10-22T14:55:48.693

Reputation: 12 293

I originally discounted factorials because computing one in Runic takes 3 bytes, but they're individually powerful, definitely boosted my score. – Draco18s no longer trusts SE – 2019-10-22T16:33:05.473

2

Python 3 approx 9↑↑(36^8) 9↑↑(36↑(9↑↑3))

print("1"*eval("**".join("9"*int('z'*9**9**9,36)))

Must calculate first.

(Edited because I'm bad at math notation, and to include an improvement from randomdude999)

mypetlion

Posted 2019-10-22T14:55:48.693

Reputation: 702

19**9**9 is larger than 9999999. – randomdude999 – 2019-10-22T17:52:53.063

1Pretty sure your score is correct, though I am not 100% certain (for reference x↑↑y ~= 10↑↑y; the y makes a bigger impact and that's a BIG y). – Draco18s no longer trusts SE – 2019-10-22T17:54:55.403

@Draco18s The int(..., 36) means "This number in base-36". With the first argument, it's 'zzzz....' as an integer with 0-9 then a-z as the digits. So, I'm pretty sure that it's just one arrow. – mypetlion – 2019-10-22T18:21:29.013

1I knew what the command was, I just couldn't deal with what the resulting value was. I think you're correct though. – Draco18s no longer trusts SE – 2019-10-22T18:26:27.330

@Draco18s Oh gotcha. Thanks for the help with the notation! Never been my strong suit. – mypetlion – 2019-10-22T18:37:23.283

Yep, ended up having some understandings in that regard, too. Just like x^y * x^z = x^(y+z), (x↑↑y)^(x↑↑z) is equal to x↑↑(y+z). I just found it really fascinating that factorial(x↑↑y) equals* x↑↑(y+1). *Or is at least a pretty good approximation.

– Draco18s no longer trusts SE – 2019-10-22T21:20:08.433

The result can be approximated to 9↑↑9↑↑4, which in turn is somewhere between 9↑↑↑2 and 9↑↑↑3. From my understanding, this means it should be the highest score at the moment. – AlienAtSystem – 2019-10-23T14:44:01.747

1

PHP, 43 bytes, Score: ~1e17 (based on my PC performance)

set_time_limit(-1);while(time()<4e9)echo 1;

Try it online!

This will run until 2096-10-02 and then stop. This isn't an infinite loop as it will finally halt. I can set it to longer dates, but I think 4e9 or 2096-10-02 is good enough for me, it is about the idea

Night2

Posted 2019-10-22T14:55:48.693

Reputation: 5 484

1This is dumb, but it works. – Draco18s no longer trusts SE – 2019-10-22T15:39:08.040

4Even if this printed one 1 every nanosecond this would score much less than most of the other answers so far. – FryAmTheEggman – 2019-10-22T15:42:29.230

@FryAmTheEggman, true. – Night2 – 2019-10-22T15:52:21.870

0

05AB1E, approx. (10↑↑46)10.994 amount of 1s (50 bytes)

žm!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1×

Explanation:

žm             # Push the builtin 9876543210
  !!!...!!!    # Take the factorial 46 times
           1×  # Push that many 1s as string
               # (after which it's output implicitly as result)

This will print exactly \$9876543210↑↑46\$ amount of 1s, or approx. \$(10↑↑46)^{10.994}\$ (thanks to @Draco18s for explaining how to calculate this \$(10↑↑a)^b\$ approximation.

Kevin Cruijssen

Posted 2019-10-22T14:55:48.693

Reputation: 67 575

how large 9876543210↑↑56 is. Only about (10↑↑56)^11. Two arrows (10↑↑2) is just powers (10^10) (or 10↑↑3 -> 10^10^10), so the number on the right matters more than the number on the left. It works out that each factorial adds a 10 to the tower. Also, I think your tower is 46, not 56. – Draco18s no longer trusts SE – 2019-10-22T17:01:30.690

@Draco18s Oops, 46 instead of 56 indeed, edited. I know $10↑↑3$ is $10^{{10}^{10}}$, I just wasn't sure how large $9876543210↑↑46$ is when using $10↑↑x$ as well. I'm still not sure how you calculated that $11$ in $9876543210↑↑56 ≈ (10↑↑56)^{11}$ to be honest, or is the $11$ the size of the integer on the right + 1? – Kevin Cruijssen – 2019-10-22T17:12:12.740

1

I understood why you had the question, it just works out that x↑↑y is approximately equal to (10↑↑y) (or closer to (10↑↑y)^(log10(2x))). eg 100↑↑4 and 10↑↑4. Note that the first one is (10↑↑4)^2.3, but W|A displays powers of ten up to 5 digits, but we can extract the right value. The log10 bit just tacks on to the end of the stack (100↑↑4 -> 10^10^10^10^2.3), parents only distinguish it from 10↑↑(10^2.3) (wrong!)

– Draco18s no longer trusts SE – 2019-10-22T17:25:46.620

@Draco18s Hmm ok. But why the $11$ then? Since $\log_{10}(2×9876543210)$ seems to be approx. $10.296$ instead of $11$. So the $9876543210↑↑46$ in my answer would be roughly $(10↑↑46)^{10.296}$ in that case?

– Kevin Cruijssen – 2019-10-22T17:39:59.980

1

Works out to what happened when I plugged it (9876543210) in to W|A 5 times. I got 10.994. The log10(2x) is only an approximation, and its a bit low. (100 results in a power of 200.3 on top of the tens, for example, not exactly 200). But if I plug in 15 copies instead of 5, that last value doesn't change (or if it does, its very small), so its easy to extrapolate what happens at 50 copies.

– Draco18s no longer trusts SE – 2019-10-22T17:45:28.310

@Draco18s Ah ok, now it makes a bit more sense, thanks. I'll edit my answer to add the $10↑↑x$ notation. – Kevin Cruijssen – 2019-10-22T17:53:30.163