Skip to main content
Commonmark migration
Source Link

#05AB1E, 15 13 12 10 bytes

05AB1E, 15 13 12 10 bytes

₄4°ŸεW°ö9Q

-2 bytes thanks to @Emigna
-3 bytes thanks to @Grimy

Try it online.

Explanation:

₄4°Ÿ        # Create a list in the range [1000,10000]
    ʒ       # Filter this list by:
     W      #  Get the smallest digit in the number (without popping the number itself)
      °     #  Take 10 to the power this digit
       ö    #  Convert the number from this base to an integer (in base-10)
        9Q  #  Check if it's equal to 9
  • If the smallest digit is \$d=0\$ it will become \$1\$ with the \$10^d\$ (°). And the number in base-1 converted to an integer in base-10 (ö) would act like a sum of digits.
  • If the smallest digit is \$d=1\$ it will become \$10\$ with the \$10^d\$ (°). And the number in base-10 converted to an integer in base-10 (ö) will of course remain the same.
  • If the smallest digit is \$d=2\$ it will become \$100\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 0 in this case (i.e. 2345 becomes 2030405).
  • If the smallest digit is \$d=3\$ it will become \$1000\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 00 in this case (i.e. 3456 becomes 3004005006).
  • ... etc. Smallest digits \$d=[4,9]\$ would act the same as \$d=2\$ and \$d=3\$ above, with \$d-1\$ amount of 0s in the 'join'.

If the smallest digit is \$>0\$ with the given range \$[1000,10000]\$, the resulting number after °ö would then be within the range \$[1111,9000000009000000009000000009]\$, so can never be equal to \$9\$. If the result is equal to \$9\$ (9Q) it would mean the smallest digit is \$d=0\$, resulting in a base-1 with °ö; and the sum of the digits was \$9\$.

#05AB1E, 15 13 12 10 bytes

₄4°ŸεW°ö9Q

-2 bytes thanks to @Emigna
-3 bytes thanks to @Grimy

Try it online.

Explanation:

₄4°Ÿ        # Create a list in the range [1000,10000]
    ʒ       # Filter this list by:
     W      #  Get the smallest digit in the number (without popping the number itself)
      °     #  Take 10 to the power this digit
       ö    #  Convert the number from this base to an integer (in base-10)
        9Q  #  Check if it's equal to 9
  • If the smallest digit is \$d=0\$ it will become \$1\$ with the \$10^d\$ (°). And the number in base-1 converted to an integer in base-10 (ö) would act like a sum of digits.
  • If the smallest digit is \$d=1\$ it will become \$10\$ with the \$10^d\$ (°). And the number in base-10 converted to an integer in base-10 (ö) will of course remain the same.
  • If the smallest digit is \$d=2\$ it will become \$100\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 0 in this case (i.e. 2345 becomes 2030405).
  • If the smallest digit is \$d=3\$ it will become \$1000\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 00 in this case (i.e. 3456 becomes 3004005006).
  • ... etc. Smallest digits \$d=[4,9]\$ would act the same as \$d=2\$ and \$d=3\$ above, with \$d-1\$ amount of 0s in the 'join'.

If the smallest digit is \$>0\$ with the given range \$[1000,10000]\$, the resulting number after °ö would then be within the range \$[1111,9000000009000000009000000009]\$, so can never be equal to \$9\$. If the result is equal to \$9\$ (9Q) it would mean the smallest digit is \$d=0\$, resulting in a base-1 with °ö; and the sum of the digits was \$9\$.

05AB1E, 15 13 12 10 bytes

₄4°ŸεW°ö9Q

-2 bytes thanks to @Emigna
-3 bytes thanks to @Grimy

Try it online.

Explanation:

₄4°Ÿ        # Create a list in the range [1000,10000]
    ʒ       # Filter this list by:
     W      #  Get the smallest digit in the number (without popping the number itself)
      °     #  Take 10 to the power this digit
       ö    #  Convert the number from this base to an integer (in base-10)
        9Q  #  Check if it's equal to 9
  • If the smallest digit is \$d=0\$ it will become \$1\$ with the \$10^d\$ (°). And the number in base-1 converted to an integer in base-10 (ö) would act like a sum of digits.
  • If the smallest digit is \$d=1\$ it will become \$10\$ with the \$10^d\$ (°). And the number in base-10 converted to an integer in base-10 (ö) will of course remain the same.
  • If the smallest digit is \$d=2\$ it will become \$100\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 0 in this case (i.e. 2345 becomes 2030405).
  • If the smallest digit is \$d=3\$ it will become \$1000\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 00 in this case (i.e. 3456 becomes 3004005006).
  • ... etc. Smallest digits \$d=[4,9]\$ would act the same as \$d=2\$ and \$d=3\$ above, with \$d-1\$ amount of 0s in the 'join'.

If the smallest digit is \$>0\$ with the given range \$[1000,10000]\$, the resulting number after °ö would then be within the range \$[1111,9000000009000000009000000009]\$, so can never be equal to \$9\$. If the result is equal to \$9\$ (9Q) it would mean the smallest digit is \$d=0\$, resulting in a base-1 with °ö; and the sum of the digits was \$9\$.

added 1137 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

#05AB1E, 15 13 1212 10 bytes

₄4°ŸʒD0åôO9Q₄4°ŸεW°ö9Q

-2 bytes thanks to @Emigna
-1 byte3 bytes thanks to @Grimy

Try it online.Try it online.

₄4°Ÿ             # Create a list in the range [1000,10000]
    ʒ            # Filter this list by:
     D     W      #  DuplicateGet the current number
      0å         # smallest Checkdigit ifin the number contains a 0 (1 if truthy; 0 if falsey)
        ô        # without Splitpopping the duplicated number into parts of that sizeitself)
            °     #   i.e.Take 102010 isto truthy,the sopower becomesthis [1,0,2,0]digit
             ö    #   i.e. 1234 is falsey, so becomes ["0"]
         O Convert the number from this base #to an Suminteger that(in listbase-10)
          9Q     #  And checkCheck if it's equal to 9
  • If the smallest digit is \$d=0\$ it will become \$1\$ with the \$10^d\$ (°). And the number in base-1 converted to an integer in base-10 (ö) would act like a sum of digits.
  • If the smallest digit is \$d=1\$ it will become \$10\$ with the \$10^d\$ (°). And the number in base-10 converted to an integer in base-10 (ö) will of course remain the same.
  • If the smallest digit is \$d=2\$ it will become \$100\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 0 in this case (i.e. 2345 becomes 2030405).
  • If the smallest digit is \$d=3\$ it will become \$1000\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 00 in this case (i.e. 3456 becomes 3004005006).
  • ... etc. Smallest digits \$d=[4,9]\$ would act the same as \$d=2\$ and \$d=3\$ above, with \$d-1\$ amount of 0s in the 'join'.

If the smallest digit is \$>0\$ with the given range \$[1000,10000]\$, the resulting number after °ö would then be within the range \$[1111,9000000009000000009000000009]\$, so can never be equal to \$9\$. If the result is equal to \$9\$ (9Q) it would mean the smallest digit is \$d=0\$, resulting in a base-1 with °ö; and the sum of the digits was \$9\$.

#05AB1E, 15 13 12 bytes

₄4°ŸʒD0åôO9Q

-2 bytes thanks to @Emigna
-1 byte thanks to @Grimy

Try it online.

₄4°Ÿ             # Create a list in the range [1000,10000]
    ʒ            # Filter this list by:
     D           #  Duplicate the current number
      0å         #  Check if the number contains a 0 (1 if truthy; 0 if falsey)
        ô        #  Split the duplicated number into parts of that size
                 #   i.e. 1020 is truthy, so becomes [1,0,2,0]
                 #   i.e. 1234 is falsey, so becomes ["0"]
         O       #  Sum that list
          9Q     #  And check if it's equal to 9

#05AB1E, 15 13 12 10 bytes

₄4°ŸεW°ö9Q

-2 bytes thanks to @Emigna
-3 bytes thanks to @Grimy

Try it online.

₄4°Ÿ        # Create a list in the range [1000,10000]
    ʒ       # Filter this list by:
     W      #  Get the smallest digit in the number (without popping the number itself)
      °     #  Take 10 to the power this digit
       ö    #  Convert the number from this base to an integer (in base-10)
        9Q  #  Check if it's equal to 9
  • If the smallest digit is \$d=0\$ it will become \$1\$ with the \$10^d\$ (°). And the number in base-1 converted to an integer in base-10 (ö) would act like a sum of digits.
  • If the smallest digit is \$d=1\$ it will become \$10\$ with the \$10^d\$ (°). And the number in base-10 converted to an integer in base-10 (ö) will of course remain the same.
  • If the smallest digit is \$d=2\$ it will become \$100\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 0 in this case (i.e. 2345 becomes 2030405).
  • If the smallest digit is \$d=3\$ it will become \$1000\$ with the \$10^d\$ (°). And the number in base-100 convert to an integer in base-10 (ö) would act like a join with 00 in this case (i.e. 3456 becomes 3004005006).
  • ... etc. Smallest digits \$d=[4,9]\$ would act the same as \$d=2\$ and \$d=3\$ above, with \$d-1\$ amount of 0s in the 'join'.

If the smallest digit is \$>0\$ with the given range \$[1000,10000]\$, the resulting number after °ö would then be within the range \$[1111,9000000009000000009000000009]\$, so can never be equal to \$9\$. If the result is equal to \$9\$ (9Q) it would mean the smallest digit is \$d=0\$, resulting in a base-1 with °ö; and the sum of the digits was \$9\$.

deleted 1018 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

#05AB1E, 15 13 13 12 bytes

₄4°Ÿʒ0å}ʒSO9Q₄4°ŸʒD0åôO9Q

-2 bytes thanks to @Emigna.
-1 byte thanks to @Grimy

Try it online.Try it online.

₄4°Ÿ             # ListCreate a list in the range [1000,10000]
    ʒ  }         # Filter this list by:
         #  The number contains a 0
        ʒ        # Filter the filteredthis list further by:
         SO9Q    #  The sum of its digits is exactly 9

13-bytes alternative:

₄4°ŸʒW_sSO9Q*

Try it online.

Explanation:

₄4°Ÿ  D           # List inDuplicate the rangecurrent [1000,10000]number
    ʒ            # Filter this list by:
     W_          # Check Takeif the minimum digit (without popping), and check ifnumber it'scontains a 0
         (1 if truthy; *0 if falsey)
  #  And
    ô   sSO9Q     #  WhereSplit the sumduplicated ofnumber itsinto digitsparts isof exactlythat 9

And yet another 13-bytes alternative:

4°Lʒ0å}ʒÇOт·-size

Credit for this alternative goes to @Mr.Xcoder.

Try it online.

Explanation:

4°L              # List in the range [1,10000]
   ʒ  }          # Filter this list by:
    0å           #i.e. 1020 Theis numbertruthy, containsso abecomes [1,0,2,0]
       ʒ         # Filter the filtered list further by:
        Ç      #  # i.e. Convert1234 theis digitsfalsey, toso unicodebecomes values["0"]
         O       #  Take the sum
          т·-    #  Subtract 200 (Only 1 is truthy in 05AB1E, and the sumSum ofthat digitslist
            9Q     #              And check asif unicodeit's valuesequal equalingto 9 is 201)

#05AB1E, 15 13 bytes

₄4°Ÿʒ0å}ʒSO9Q

-2 bytes thanks to @Emigna.

Try it online.

₄4°Ÿ             # List in the range [1000,10000]
    ʒ  }         # Filter this list by:
         #  The number contains a 0
        ʒ        # Filter the filtered list further by:
         SO9Q    #  The sum of its digits is exactly 9

13-bytes alternative:

₄4°ŸʒW_sSO9Q*

Try it online.

Explanation:

₄4°Ÿ             # List in the range [1000,10000]
    ʒ            # Filter this list by:
     W_          #  Take the minimum digit (without popping), and check if it's a 0
            *    #  And
       sSO9Q     #  Where the sum of its digits is exactly 9

And yet another 13-bytes alternative:

4°Lʒ0å}ʒÇOт·-

Credit for this alternative goes to @Mr.Xcoder.

Try it online.

Explanation:

4°L              # List in the range [1,10000]
   ʒ  }          # Filter this list by:
    0å           #  The number contains a 0
       ʒ         # Filter the filtered list further by:
        Ç        #  Convert the digits to unicode values
         O       #  Take the sum
          т·-    #  Subtract 200 (Only 1 is truthy in 05AB1E, and the sum of digits
                 #                as unicode values equaling 9 is 201)

#05AB1E, 15 13 12 bytes

₄4°ŸʒD0åôO9Q

-2 bytes thanks to @Emigna
-1 byte thanks to @Grimy

Try it online.

₄4°Ÿ             # Create a list in the range [1000,10000]
    ʒ            # Filter this list by:
     D           #  Duplicate the current number
               #  Check if the number contains a 0 (1 if truthy; 0 if falsey)
        ô        #  Split the duplicated number into parts of that size
                 #   i.e. 1020 is truthy, so becomes [1,0,2,0]
                 #   i.e. 1234 is falsey, so becomes ["0"]
         O       #  Sum that list
          9Q     #  And check if it's equal to 9
added 1455 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384
Loading
Forgot to update the TIO
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384
Loading
added 68 characters in body
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384
Loading