g | x | w | all
Bytes Lang Time Link
825Vyxal240905T144253Zpacman25
011Jelly231230T081641ZNick Ken
135Python 3220630T193318ZFmbalbue
064Regenerate a220711T010709Zthejonym
071Python220710T215123Zlynn
271Batch220710T210052ZYouserna
075Python 3220704T062213Zthe defa
012Pyth220701T153443Zmath jun
080Python 2220630T190413ZKevin Cr
067JavaScript V8220630T174857ZArnauld
018K ngn/k220630T180442Zovs
106Rust220701T092135Zmousetai
062Ruby220701T055622ZG B
026Charcoal220701T001336ZNeil
050Retina 0.8.2220701T000203ZNeil
058Factor + math.combinatorics220630T181940Zchunes
010Husk220630T211049Zovs
01105AB1E220630T180515ZKevin Cr

Vyxal, 66 bitsv2, 8.25 bytes

⁺ŀfʀΠvṖÞfU

Try it Online!

Bitstring:

111111011001001101001110100101101000111101101011000011001000110100

Jelly, 11 bytes

6p3’Ż€Œ!€ẎQ

Try it online!

A niladic link that returns the 64 triples. This is my answer to the follow-up question but with the sorting code removed.

Python 3, 161 146 141 135 bytes

from itertools import*
for u in product(*[range(6)]*3):
 i,j,k=u
 if 0not in u or i>2and j>2or j>2and k>2or k>2and i>2:1
 else:print(u)

Try it online!

-5 thanks to qwr

Regenerate -a, 73 64 bytes

[345]([12]0|0[012])|[12]([1-5]0|0[0-5])|0([012][0-5]|[345][012])

Attempt This Online!

Surprised nopony did this yet. Probably golfable!

EDIT: -9 thanks to math junkie for reminding me of the shorter output format. Now it's 1 byte per combination :P I still think it can be golfed further, possibly with a new approach :-)c

Python, 71 bytes

for x in range(521):max(s:='%03d'%x)<'6'!=['0','3']>sorted(s)==print(s)

Attempt This Online!

I took the ['0','3']>sorted(s) idea from ovs.

Batch, 271 bytes

@!! 2>nul||cmd/q/v/c%0&&exit/b&for /l %%i in (0,1,5)do @(for /l %%j in (0,1,5)do @(for /l %%k in (0,1,5)do @(set s=%%i%%j%%k&set p=!s:0=!&if !p:~!==~ set p=0
if !p!. neq !s!. set/af=!p!/10&set/al=!p!%%10&if !f! lss !l! (if !f! leq 2 echo !s!)else if !l! leq 2 echo !s!)))

Python 3, 75 bytes

print([r for r in[(x//36,x//6%6,x%6)for x in range(216)]if[0,3]>sorted(r)])

Try it online!

Pyth, 12 bytes

f>,Z3ST^U6 3

Try it online!

Port of Kevin Cruijssen's Python answer

f>,Z3ST^U6 3
        U6    Range up to 6 = [0,1,2,3,4,5]
       ^   3  Cartesian product with itself 3 times = [0,1,2,3,4,5] * [0,1,2,3,4,5] * [0,1,2,3,4,5]
f             Filter for elements T such that:
 >,Z3ST       [0,3] > sorted(T)

Python 2, 82 80 bytes

from itertools import*
print[k for k in product(*[range(6)]*3)if[0,3]>sorted(k)]

-2 bytes thanks to @ovs.

Try it online.

Explanation:

JavaScript (V8),  75  67 bytes

Saved 8 bytes thanks to @tsh

Prints one comma-separated triplet per line.

for(i=216;i--;)[...a=[i/36%6|0,i/6%6|0,i%6]].sort()<'0,3'&&print(a)

Try it online!

K (ngn/k), 20 18 bytes

?,/+'!'1|3*<'+!3#3

Try it online!

+!3#3 All triples with values in 0 1 2.
<' Grade up each triple. This results in all permutations of 0 1 2 with some duplicates.
1|3* Multiply by 3 and take maximum with 1 to generate all permutations of 6 3 1.
+'!' For each permutation, generate all triples where the each entry is a non-negative integer less than the number in the permutation at the same index.
?,/ Flatten into a matrix with three columns and take the unique rows.

Rust, 106 bytes

for i in 0..6{for j in 0..6{for k in 0..6{let mut t=[i,j,k];t.sort();if t<[0,3,6]{print!("{i}{j}{k}
")}}}}

Actually using nested loops is barely shorter than my attempt using itertoools.

Attempt This Online!

Ruby, 62 bytes

p (z=*0..5).product(z,z).select{|x|x.min<1&&(x-[3,4,5])[1]}|[]

Try it online!

Charcoal, 26 bytes

ΦEφ﹪%03dι∧№ι0∧›6⌈ι›²ΣEι‹2λ

Try it online! Link is to verbose version of code. Explanation:

  φ                         Predefined variable `1000`
 E                          Map over implicit range
        ι                   Current value
   ﹪%03d                    Formatted to 3 0-filled digits
Φ                           Filtered where
           ι                Current value
          №                 Contains
            0               Literal string `0`
         ∧                  Logical And
               6            Literal string `6`
              ›             Is greater than
                 ι          Current value
                ⌈           Maximum character
             ∧              Logical And
                   ²        Literal integer `2`
                  ›         Is greater than
                      ι     Current value
                     E      Map over digits
                        2   Literal string `2`
                       ‹    Is less than
                         λ  Current digit
                    Σ       Take the sum
                            Implicitly print

28 bytes for the prettier version:

ΦEφ⪫﹪%03dι-∧№ι0∧›6⌈ι›²ΣEι‹2λ

Try it online! Link is to verbose version of code.

Retina 0.8.2, 50 bytes


520$*¶

00$.`
.+(...)
$1
G`0
A`[3-5].*[3-5]|[6-9]

Try it online! Link includes footer that prettifies the output. Explanation:


520$*¶

00$.`
.+(...)
$1

List all the integers from 0 to 520 inclusive, padded to 3 digits.

G`0

Only keep those integers with at least one 0 digit.

A`[3-5].*[3-5]|[6-9]

Discard those with more than one digit greater than 2 or with a digit greater than 5.

Factor + math.combinatorics, 59 58 bytes

6 iota 3 selections [ natural-sort "\0"before? ] filter .

Try it online!

-1 byte from a tip by @ovs.

Note the string "\0" has literal control character 3 embedded as well as the 0; you can see it on TIO. This string is equivalent to the longer (but clearer) sequence { 0 3 }.

Husk, 10 bytes

uΣmPΠmŀ∫ḣ3

Try it online!

Similar to my K answer.

       ∫ḣ3  -- cumulative sums of [1..3] -> [1,3,6]
     mŀ     -- lowered range of each     -> [[0],[0,1,2],[0,1,2,3,4,5]]
    Π       -- cartesian product of the three lists
  mP        -- for each triplet, get all permutations
 Σ          -- flatten into a list of triplets
u           -- get the unique ones

05AB1E, 13 11 bytes

5Ý3ãʒ{₆1š‹P

-2 bytes thanks to a tip of @ovs using 136.

Outputs as a list of triplets.

Try it online.

Explanation:

5Ý           # Push a list in the range [0,5]
  3ã         # Cartesian power of 3: get all triplets using these [0,1,2,3,4,5]
    ʒ        # Filter this list by:
     {       #  Sort the triplet from lowest to highest
      ƵZ     #  Push compressed integer 136
        S    #  Convert it to a list of digits: [1,3,6]
         ‹   #  Check for sorted triplet [a,b,c] whether [a<1,b<3,c<6]
          P  #  Check if all three are truthy
             # (after which the filtered list of 64 triplets is output implicitly)

ƵZS could alternatively be ₆1š for the same byte-count: try it online.

      ₆      #  Push 36
       1š    #  Convert it to a list of digits, and prepend 1

See this 05AB1E tip of mine (section How to compress large integers?) to understand why ƵZ is 136.