Skip to main content
deleted 85 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 5 4 bytes

$g×*

-1 byte porting emanresuA's Jelly answer

Try it online or verify all test cases.

Original 5 bytes answer: Alternative 4-byter (port of @Bubbler's Japt answer:

ā<°*OgиTβ

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

$      # Push 1 and the input
 g     # Pop the input, and push its length
  ×    # Repeat 1 that many times
   *   # Multiply it to the (implicit) input-integer
       # (after which the result is output implicitly)

ā g     # Push athe listlength inof the range [1, (implicit) input-length] (without popping)integer
 < и    # Decrease it toRepeat the range [0, length(implicit)
  °    # Get 10 to the power each valueinput-list inthat themany listtimes
   *   # Multiply each by the input that's still on the stack
Convert it from a Obase-10 list #to Suma itbase-10 togetherinteger
       # (after which the result is output implicitly)

05AB1E, 5 4 bytes

$g×*

-1 byte porting emanresuA's Jelly answer

Try it online or verify all test cases.

Original 5 bytes answer:

ā<°*O

Try it online or verify all test cases.

Explanation:

$      # Push 1 and the input
 g     # Pop the input, and push its length
  ×    # Repeat 1 that many times
   *   # Multiply it to the (implicit) input-integer
       # (after which the result is output implicitly)

ā      # Push a list in the range [1, (implicit) input-length] (without popping)
 <     # Decrease it to the range [0, length)
  °    # Get 10 to the power each value in the list
   *   # Multiply each by the input that's still on the stack
    O  # Sum it together
       # (after which the result is output implicitly)

05AB1E, 5 4 bytes

$g×*

-1 byte porting emanresuA's Jelly answer

Try it online or verify all test cases.

Alternative 4-byter (port of @Bubbler's Japt answer:

gиTβ

Try it online or verify all test cases.

Explanation:

$     # Push 1 and the input
 g    # Pop the input, and push its length
  ×   # Repeat 1 that many times
   *  # Multiply it to the (implicit) input-integer
      # (after which the result is output implicitly)

g     # Push the length of the (implicit) input-integer
 и    # Repeat the (implicit) input-list that many times
    # Convert it from a base-10 list to a base-10 integer
      # (after which the result is output implicitly)
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 5 4 bytes

$g×*

-1 byte porting emanresuA's Jelly answer

Try it online or verify all test cases.

Original 5 bytes answer:

ā<°*O

Try it online or verify all test cases.

Explanation:

$      # Push 1 and the input
 g     # Pop the input, and push its length
  ×    # Repeat 1 that many times
   *   # Multiply it to the (implicit) input-integer
       # (after which the result is output implicitly)

ā      # Push a list in the range [1, (implicit) input-length] (without popping)
 <     # Decrease it to the range [0, length)
  °    # Get 10 to the power each value in the list
   *   # Multiply each by the input that's still on the stack
    O  # Sum it together
       # (after which the result is output implicitly)