Skip to main content
Added large test
Source Link

Perl 6, 20 bytes

{[~] 1..*Z~($_...1)}

Test it

With an input of 100000 this takes roughly 10 seconds, including compilation and printing the output.

Expanded:

{                # bare block lambda with implicit parameter 「$_」

  [~]            # reduce using concatenation operator 「&infix:«~»」
                 # (shorter than 「join '',」)

    1 .. *       # Range from 1 to infinity

    Z~           # zip using concatenation operator

    ( $_ ... 1 ) # deduced sequence starting at the input
                 # going down to 1
}

The Z~ needs the ~ because otherwise it generates a list of lists which will stringify with spaces.

There is no need to limit the Range starting at 1, because Z stops when any of the input lists run out.
This saves two bytes (a space would be needed after $_)

Perl 6, 20 bytes

{[~] 1..*Z~($_...1)}

Test it

Expanded:

{                # bare block lambda with implicit parameter 「$_」

  [~]            # reduce using concatenation operator 「&infix:«~»」
                 # (shorter than 「join '',」)

    1 .. *       # Range from 1 to infinity

    Z~           # zip using concatenation operator

    ( $_ ... 1 ) # deduced sequence starting at the input
                 # going down to 1
}

The Z~ needs the ~ because otherwise it generates a list of lists which will stringify with spaces.

There is no need to limit the Range starting at 1, because Z stops when any of the input lists run out.
This saves two bytes (a space would be needed after $_)

Perl 6, 20 bytes

{[~] 1..*Z~($_...1)}

Test it

With an input of 100000 this takes roughly 10 seconds, including compilation and printing the output.

Expanded:

{                # bare block lambda with implicit parameter 「$_」

  [~]            # reduce using concatenation operator 「&infix:«~»」
                 # (shorter than 「join '',」)

    1 .. *       # Range from 1 to infinity

    Z~           # zip using concatenation operator

    ( $_ ... 1 ) # deduced sequence starting at the input
                 # going down to 1
}

The Z~ needs the ~ because otherwise it generates a list of lists which will stringify with spaces.

There is no need to limit the Range starting at 1, because Z stops when any of the input lists run out.
This saves two bytes (a space would be needed after $_)

Source Link

Perl 6, 20 bytes

{[~] 1..*Z~($_...1)}

Test it

Expanded:

{                # bare block lambda with implicit parameter 「$_」

  [~]            # reduce using concatenation operator 「&infix:«~»」
                 # (shorter than 「join '',」)

    1 .. *       # Range from 1 to infinity

    Z~           # zip using concatenation operator

    ( $_ ... 1 ) # deduced sequence starting at the input
                 # going down to 1
}

The Z~ needs the ~ because otherwise it generates a list of lists which will stringify with spaces.

There is no need to limit the Range starting at 1, because Z stops when any of the input lists run out.
This saves two bytes (a space would be needed after $_)