Skip to main content
added 397 characters in body
Source Link
Kjetil S
  • 6.1k
  • 10
  • 22

Perl 5, 4942 bytes

This prints TSIJMU infinitely:

$i=1;1while$s+=1/++$i*($s+1/$i<1?say$i:-1)

Try it online!

...or until Try It Online reaches its limit of 128 KiB of output. Exploits that say$i prints that sequence number and then returns 1.

This is seven bytes longer and takes n from stdin:

$i=1;$s+=1/++$i*($s+1/$i<1?$_--&&say$i:-1)while$_

Try it online!

Perl 5, 49 bytes

$i=1;$s+=1/++$i*($s+1/$i<1?$_--&&say$i:-1)while$_

Try it online!

Perl 5, 42 bytes

This prints TSIJMU infinitely:

$i=1;1while$s+=1/++$i*($s+1/$i<1?say$i:-1)

Try it online!

...or until Try It Online reaches its limit of 128 KiB of output. Exploits that say$i prints that sequence number and then returns 1.

This is seven bytes longer and takes n from stdin:

$i=1;$s+=1/++$i*($s+1/$i<1?$_--&&say$i:-1)while$_

Try it online!

Source Link
Kjetil S
  • 6.1k
  • 10
  • 22

Perl 5, 49 bytes

$i=1;$s+=1/++$i*($s+1/$i<1?$_--&&say$i:-1)while$_

Try it online!