Skip to main content
Commonmark migration
Source Link

#Pyth, 22 19 bytes

Pyth, 22 19 bytes

f&}\0Tq201sCMT`M^T4

Output is an array of strings. Try it online here.

f&}\0Tq201sCMT`M^T4   
              `M^T4   Array of strings of numbers 0-999
f                     Keep the elements of the above, as T, where:
           CMT          Get the code points of each character in T
          s             Take the sum
      q201              Does the above == 201?
  }\0T                  Does T contain "0" ?
 &                      Logical AND the two previous results

The 201 trick is the same as used in other answers.

Previous answer, without using 201 trick, 22 bytes: iRTf}0Tfq9sTjRTr^T3^T4

#Pyth, 22 19 bytes

f&}\0Tq201sCMT`M^T4

Output is an array of strings. Try it online here.

f&}\0Tq201sCMT`M^T4   
              `M^T4   Array of strings of numbers 0-999
f                     Keep the elements of the above, as T, where:
           CMT          Get the code points of each character in T
          s             Take the sum
      q201              Does the above == 201?
  }\0T                  Does T contain "0" ?
 &                      Logical AND the two previous results

The 201 trick is the same as used in other answers.

Previous answer, without using 201 trick, 22 bytes: iRTf}0Tfq9sTjRTr^T3^T4

Pyth, 22 19 bytes

f&}\0Tq201sCMT`M^T4

Output is an array of strings. Try it online here.

f&}\0Tq201sCMT`M^T4   
              `M^T4   Array of strings of numbers 0-999
f                     Keep the elements of the above, as T, where:
           CMT          Get the code points of each character in T
          s             Take the sum
      q201              Does the above == 201?
  }\0T                  Does T contain "0" ?
 &                      Logical AND the two previous results

The 201 trick is the same as used in other answers.

Previous answer, without using 201 trick, 22 bytes: iRTf}0Tfq9sTjRTr^T3^T4

Saved 3 bytes
Source Link
Sok
  • 6.2k
  • 1
  • 17
  • 30

#Pyth, 2222 19 bytes

iRTff&}0Tfq9sTjRTr^T3^T4\0Tq201sCMT`M^T4

Output is an array of strings. Try it online herehere.

iRTff&}0Tfq9sTjRTr^T3^T4
               r         Range from...
                ^T3      ... 10^3 ...
                   ^T4  \0Tq201sCMT`M^T4 ... to 10^4
            jRT          Convert`M^T4 each to digitArray arrayof (convertstrings toof basenumbers 10)0-999
   f    f                 Keep the elements of the above, as T, where:
          sT  CMT          Get the code Sumpoints of T
     each character in q9T
          s       Equal to 9
   f  Take the sum
      q201           Keep the elements ofDoes the above, as T,== where:201?
    }0T   \0T                 0 isDoes aT membercontain of"0" T?
iRT &                     Convert eachLogical remainingAND elementthe backtwo toprevious integerresults

The 201 trick is the same as used in other answers.

Previous answer, without using 201 trick, 22 bytes: iRTf}0Tfq9sTjRTr^T3^T4

#Pyth, 22 bytes

iRTf}0Tfq9sTjRTr^T3^T4

Try it online here.

iRTf}0Tfq9sTjRTr^T3^T4
               r         Range from...
                ^T3      ... 10^3 ...
                   ^T4   ... to 10^4
            jRT          Convert each to digit array (convert to base 10)
       f                 Keep the elements of the above, as T, where:
          sT               Sum of T
        q9                 Equal to 9
   f                     Keep the elements of the above, as T, where:
    }0T                    0 is a member of T
iRT                      Convert each remaining element back to integer

#Pyth, 22 19 bytes

f&}\0Tq201sCMT`M^T4

Output is an array of strings. Try it online here.

f&}\0Tq201sCMT`M^T4   
              `M^T4   Array of strings of numbers 0-999
f                     Keep the elements of the above, as T, where:
           CMT          Get the code points of each character in T
          s             Take the sum
      q201              Does the above == 201?
  }\0T                  Does T contain "0" ?
 &                      Logical AND the two previous results

The 201 trick is the same as used in other answers.

Previous answer, without using 201 trick, 22 bytes: iRTf}0Tfq9sTjRTr^T3^T4

Source Link
Sok
  • 6.2k
  • 1
  • 17
  • 30

#Pyth, 22 bytes

iRTf}0Tfq9sTjRTr^T3^T4

Try it online here.

iRTf}0Tfq9sTjRTr^T3^T4
               r         Range from...
                ^T3      ... 10^3 ...
                   ^T4   ... to 10^4
            jRT          Convert each to digit array (convert to base 10)
       f                 Keep the elements of the above, as T, where:
          sT               Sum of T
        q9                 Equal to 9
   f                     Keep the elements of the above, as T, where:
    }0T                    0 is a member of T
iRT                      Convert each remaining element back to integer