Descending digit sequences
Julia, 30 bytes
n->"$n"join(n-1:-1:0)[1:n]"$n"
This is an anonymous function that accepts an integer and returns a string. To call it, assign it to a variable.
We construct and join the descending sequence from n-1 to 0, and take the first n characters from the resulting string. We prepend and append this with the input as a string.
Verify all test cases online
CJam, 11 10 bytes
q4*~,W%s<\
Try it online. Assumes there is a trailing newline in the input. (Thanks to @jimmy23013 for saving a byte.)
Explanation
At the end of each line is what the stack looks like at that point (using 4
as an example).
q4* e# Push input x 4 times, separated by newlines. ["4\n4\n4\n4\n"]
~ e# Evaluate, separating the 4's and converting them to numbers. [4 4 4 4]
,W% e# Take the range of x and reverse it. [4 4 4 [3 2 1 0]]
s< e# Cast to string and take the first x characters. [4 4 "3210"]
\ e# Swap the top two to get the final result. [4 "3210" 4]
JavaScript (ES6), 55 52 bytes
n=>n+[...Array(m=n)].map(_=>--m).join``.slice(0,n)+n
Edit: Saved 3 bytes thanks to @WashingtonGuedes.