Skip to main content
added 183 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

05AB1E, 3 4 33 2 bytes

crossed out 4 is still regular 4 ;(

ݛJݛ

+1 byte as bugfix (L results in \$[1,0]\$ for edge-case \$n=0\$)
-1 byte thanks to @lyxal
-1 byte due to a comment of OP ("Any unambiguous output format is allowed"), so it'll output as a list

Try it online.Try it online.

Explanation:

Ý    # Push a list in the range [0, (implicit) input of STDIN]
 ›   # Check for each value whether the (implicit) input is larger
  J  # Join those 1s and 0 together
     # (after which itthis list is output implicitly as result to STDOUT)

05AB1E, 3 4 3 bytes

ݛJ

+1 byte as bugfix (L results in \$[1,0]\$ for edge-case \$n=0\$)
-1 byte thanks to @lyxal

Try it online.

Explanation:

Ý    # Push a list in the range [0, (implicit) input of STDIN]
 ›   # Check for each value whether the (implicit) input is larger
  J  # Join those 1s and 0 together
     # (after which it is output implicitly as result to STDOUT)

05AB1E, 3 4 3 2 bytes

crossed out 4 is still regular 4 ;(

Ý›

+1 byte as bugfix (L results in \$[1,0]\$ for edge-case \$n=0\$)
-1 byte thanks to @lyxal
-1 byte due to a comment of OP ("Any unambiguous output format is allowed"), so it'll output as a list

Try it online.

Explanation:

Ý   # Push a list in the range [0, (implicit) input of STDIN]
 ›  # Check for each value whether the (implicit) input is larger
    # (after which this list is output implicitly as result to STDOUT)
added 64 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

05AB1E, 43 4 3 bytes

ݦ°OÝ›J

+1 byte as bugfix (L results in \$[1,0]\$ for edge-case \$n=0\$)
-1 byte thanks to @lyxal

Try it online.

Explanation:

Ý¦Ý    # Push a list in the range [1[0, (implicit) input of STDIN]
  °   # MapCheck for each tovalue 10**value
whether the (implicit) input is Olarger
  J  # TakeJoin thethose sum1s ofand this0 listtogether
      # (after which the resultit is output implicitly as result to STDOUT)

NOTE: ݦ cannot be L, because for edge-case \$n=0\$ it will result in list \$[1,0]\$.

05AB1E, 4 bytes

ݦ°O

Try it online.

Explanation:

ݦ    # Push a list in the range [1, (implicit) input of STDIN]
  °   # Map each to 10**value
   O  # Take the sum of this list
      # (after which the result is output implicitly to STDOUT)

NOTE: ݦ cannot be L, because for edge-case \$n=0\$ it will result in list \$[1,0]\$.

05AB1E, 3 4 3 bytes

ݛJ

+1 byte as bugfix (L results in \$[1,0]\$ for edge-case \$n=0\$)
-1 byte thanks to @lyxal

Try it online.

Explanation:

Ý    # Push a list in the range [0, (implicit) input of STDIN]
    # Check for each value whether the (implicit) input is larger
  J  # Join those 1s and 0 together
     # (after which it is output implicitly as result to STDOUT)
added 102 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

05AB1E, 34 bytes

L°Oݦ°O

Try it online.Try it online.

Explanation:

Lݦ    # Push a list in the range [1, (implicit) input of STDIN]
  °   # Map each to 10**value
   O  # Take the sum of this list
      # (after which the result is output implicitly to STDOUT)

NOTE: ݦ cannot be L, because for edge-case \$n=0\$ it will result in list \$[1,0]\$.

05AB1E, 3 bytes

L°O

Try it online.

Explanation:

L    # Push a list in the range [1, (implicit) input of STDIN]
 °   # Map each to 10**value
  O  # Take the sum of this list
     # (after which the result is output implicitly to STDOUT)

05AB1E, 4 bytes

ݦ°O

Try it online.

Explanation:

ݦ    # Push a list in the range [1, (implicit) input of STDIN]
  °   # Map each to 10**value
   O  # Take the sum of this list
      # (after which the result is output implicitly to STDOUT)

NOTE: ݦ cannot be L, because for edge-case \$n=0\$ it will result in list \$[1,0]\$.

Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384
Loading