Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 75 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

1⁄8 # (Implicit input) Push to global array
 ɾṘ # (Implicit input) range(1,n+1) reversed
 ƛ # Foreach [n]
 1⁄4: # Push from global array and duplicate [n,r,r]
 n≤ # Push n and check if r >= n [n,r,b]
 :Sn*, # Duplicate, coerce to string (0 or 1), multi by n and output.
 [ # If ToS is truthy (r >= n) [n,r]
 - # Subtract [r-n] (r flag reverses arguments)
 1⁄8 # Push to global array. 

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array. It works well though, and I don't think it'd be any more golfable if the register worked properly.

Based on the insight that everything can be made of rows of 1s and 0s.

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

1⁄8 # (Implicit input) Push to global array
 ɾṘ # (Implicit input) range(1,n+1) reversed
 ƛ # Foreach [n]
 1⁄4: # Push from global array and duplicate [n,r,r]
 n≤ # Push n and check if r >= n [n,r,b]
 :Sn*, # Duplicate, coerce to string (0 or 1), multi by n and output.
 [ # If ToS is truthy (r >= n) [n,r]
 - # Subtract [r-n] (r flag reverses arguments)
 1⁄8 # Push to global array. 

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array. It works well though, and I don't think it'd be any more golfable if the register worked properly.

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

1⁄8 # (Implicit input) Push to global array
 ɾṘ # (Implicit input) range(1,n+1) reversed
 ƛ # Foreach [n]
 1⁄4: # Push from global array and duplicate [n,r,r]
 n≤ # Push n and check if r >= n [n,r,b]
 :Sn*, # Duplicate, coerce to string (0 or 1), multi by n and output.
 [ # If ToS is truthy (r >= n) [n,r]
 - # Subtract [r-n] (r flag reverses arguments)
 1⁄8 # Push to global array. 

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array. It works well though, and I don't think it'd be any more golfable if the register worked properly.

Based on the insight that everything can be made of rows of 1s and 0s.

deleted 3 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

1⁄8 # (Implicit input) Push to global array
 ɾṘ # (Implicit input) range(1,n+1) reversed
 ƛ # Foreach [n]
 1⁄4: # Push from global array and duplicate [n,r,r]
 n≤ # Push n and check if r >= n [n,r,b]
 :Sn*, # Duplicate, coerce to string (0 or 1), multi by n and output.
 [ # If ToS is truthy (r >= n) [n,r]
 - # Subtract [r-n] (r flag reverses arguments)
 1⁄8 # Push to global array. 

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array. It works well though, and I don't think it'd be any more golfable if the register worked properly.

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array.

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

1⁄8 # (Implicit input) Push to global array
 ɾṘ # (Implicit input) range(1,n+1) reversed
 ƛ # Foreach [n]
 1⁄4: # Push from global array and duplicate [n,r,r]
 n≤ # Push n and check if r >= n [n,r,b]
 :Sn*, # Duplicate, coerce to string (0 or 1), multi by n and output.
 [ # If ToS is truthy (r >= n) [n,r]
 - # Subtract [r-n] (r flag reverses arguments)
 1⁄8 # Push to global array. 

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array. It works well though, and I don't think it'd be any more golfable if the register worked properly.

deleted 3 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Vyxal r, 18(削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:1⁄8≤n≤:Sn*,[1⁄4n[-1⁄8

Try it Online! Try it Online!

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array.

Vyxal, 18 bytes

1⁄8ɾṘƛ1⁄4:1⁄8≤:Sn*,[1⁄4n-1⁄8

Try it Online!

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array.

Vyxal r, (削除) 18 (削除ここまで) 16 bytes

1⁄8ɾṘƛ1⁄4:n≤:Sn*,[-1⁄8

Try it Online!

Due to a bug with redefining the register inside a lambda, I'm forced to use the global array.

Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257
Loading

AltStyle によって変換されたページ (->オリジナル) /