Busy beaver of sorts [duplicate]

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.

• Well, there have been many extremely related challenges, with the only significant difference that they didn't arbitrarily demand unary output (codegolf.stackexchange.com/questions/18028/… is the first one I can recall; there have been some like "Golf a number bigger than [insert large number name here]") Oct 22, 2019 at 15:12
• I was looking to emulate busy beaver Turing machines in this challenge. Oct 22, 2019 at 15:13

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).

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!

• you are right, my bad Oct 22, 2019 at 15:24

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

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))))))))))))))))))))))))))))))))))))))))))))

• I originally discounted factorials because computing one in Runic takes 3 bytes, but they're individually powerful, definitely boosted my score. Oct 22, 2019 at 16:33

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)

• 9**9**9 is larger than 9999999. Oct 22, 2019 at 17:52
• Pretty 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). Oct 22, 2019 at 17:54
• @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. Oct 22, 2019 at 18:21
• I knew what the command was, I just couldn't deal with what the resulting value was. I think you're correct though. Oct 22, 2019 at 18:26
• @Draco18s Oh gotcha. Thanks for the help with the notation! Never been my strong suit. Oct 22, 2019 at 18:37

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.

• @Draco18s Sorry I overwrote your edit. Can you figure out about how big this version is? Wolfram stalls out Oct 22, 2019 at 17:25
• @Draco18s Nah, the ^x does something. factorial(9^9^9^9)^factorial(9^9^9^9) is already 10||9 wolframalpha.com/input/… Oct 22, 2019 at 18:20
• @Draco18s I'll try to work it out later, with Stirling's approximation or something Oct 22, 2019 at 18:30
• 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). Oct 22, 2019 at 19:43
• Was 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. Oct 22, 2019 at 21:14

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 😊

• This is dumb, but it works. Oct 22, 2019 at 15:39
• Even if this printed one 1 every nanosecond this would score much less than most of the other answers so far. Oct 22, 2019 at 15:42
• @FryAmTheEggman, true. Oct 22, 2019 at 15:52

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.

• 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. Oct 22, 2019 at 17:01
• @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? Oct 22, 2019 at 17:12
• 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!) Oct 22, 2019 at 17:25
• @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? Oct 22, 2019 at 17:39
• 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. Oct 22, 2019 at 17:45