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 Revisions

3 of 3
added 7 characters in body
Sanchises
  • 9.5k
  • 1
  • 37
  • 63

MATL, 21 bytes

-9Zv"l4Y29YS10:q@*Q(c

Try it online!

Explanation:

-9Zv % Generates [9 ... 2, 1, 2, ... 9]. 
 " % Iterate over this vector.
 ( % Assignment indexing. Places elements B at positions C in existing vector A.
 l % A: Dummy vector with numeric [1] in it. Is always overwritten by char '1'.
 4Y29YS % B: '0':'9', circularly shifted 9 positions to get '1':'9','0'
 10:q@*Q % C: Equally spaced indexing vector, spacing based on loop variable @.
 c % Convert to char, because A was numeric.

Golfing done:

-9Zv --> built-in, instead of -8:8|Q or even 8:PQ9:h| 
10:q@*Q --> 2 bytes shorter than l@@10*3$:
l ... c --> 1 byte shorter than 'x' (char dummy vector A)

I have attempted to get rid of the 9YS by doing the circular shift in the indexing, but this increased the byte count (10t:qwX\q@*Q instead of 9YS10:q@*Q). However, some interesting patterns were obtained in the process: Try it online!, Try it online!.

Sanchises
  • 9.5k
  • 1
  • 37
  • 63

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