Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

edited body
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61

R, 20 bytes

while(rexp(1))cat(1)

Try it online!

3 bytes longer than Giuseppe's R answer, but can output unary values greater than 2147483647.

In fact, it will nearly always output unary values that are significantly greater than 2147483647, since the chance of stopping after any outputted 1 character is about 1e-324 (the lower limit of R's double-precision numeric type, below which values are truncated to zero).
This will also nearly always exceed the output limit on TIO, so here here is a link using a modified version of the rexp function with only 1 decimal place of precision.

R, 20 bytes

while(rexp(1))cat(1)

Try it online!

3 bytes longer than Giuseppe's R answer, but can output unary values greater than 2147483647.

In fact, it will nearly always output unary values that are significantly greater than 2147483647, since the chance of stopping after any outputted 1 character is about 1e-324 (the lower limit of R's double-precision numeric type, below which values are truncated to zero).
This will also nearly always exceed the output limit on TIO, so here is a link using a modified version of the rexp function with only 1 decimal place of precision.

R, 20 bytes

while(rexp(1))cat(1)

Try it online!

3 bytes longer than Giuseppe's R answer, but can output unary values greater than 2147483647.

In fact, it will nearly always output unary values that are significantly greater than 2147483647, since the chance of stopping after any outputted 1 character is about 1e-324 (the lower limit of R's double-precision numeric type, below which values are truncated to zero).
This will also nearly always exceed the output limit on TIO, so here is a link using a modified version of the rexp function with only 1 decimal place of precision.

Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61

R, 20 bytes

while(rexp(1))cat(1)

Try it online!

3 bytes longer than Giuseppe's R answer, but can output unary values greater than 2147483647.

In fact, it will nearly always output unary values that are significantly greater than 2147483647, since the chance of stopping after any outputted 1 character is about 1e-324 (the lower limit of R's double-precision numeric type, below which values are truncated to zero).
This will also nearly always exceed the output limit on TIO, so here is a link using a modified version of the rexp function with only 1 decimal place of precision.

AltStyle によって変換されたページ (->オリジナル) /