APL (Dyalog Unicode), (削除) 38 (削除ここまで) 36 bytes
Thanks to ngn for fixing a bug while maintaining byte count.
Anonymous tacit prefix function. Requires ⎕IO (Index Origin) set to 0, which is default on many systems. Even works for 0!
⍕,{2↑'thstndrd×ばつ⊃⍵⌽∊1 0 8\⊂10↑⍳4}
{...} anonymous lambda; ⍵ is argument:
⍳4 first four ɩndices; [0,1,2,3]
10↑ take first ten elements from that, padding with zeros: [0,1,2,3,0,0,0,0,0,0]
⊂ enclose to treat as single element; [[0,1,2,3,0,0,0,0,0,0]]
1 0 8\ expand to one copy, a prototypical copy (all-zero), eight copies;
[[0,1,2,3,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,1,2,3,0,0,0,0,0,0],
[0,1,2,3,0,0,0,0,0,0],
⋮ (5 more)
[0,1,2,3,0,0,0,0,0,0]]
∊ εnlist (flatten);
[0,1,2,3,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,1,2,3,0,0,0,0,0,0,
0,1,2,3,0,0,0,0,0,0,
⋮ (50 more)
0,1,2,3,0,0,0,0,0,0]
⍵⌽ cyclically rotate left as many steps as indicated by the argument
⊃ pick the first number (i.e. the argument-mod-100'th number)
×ばつ multiply two by that (gives 0, 2, 4, or 6)
'thstndrd'↓⍨drop that many characters from this string
2↑ take the first two of the remaining characters
⍕, concatenate the stringified argument to that
- 31.8k
- 4
- 131
- 292