int ledpin=13; //stores a 13, not a 10 to that variable
As far as Arduino is concerned, that's just a number, specifically 13 being stored in that variable.
When you call digitalWrite(), the first argument is a number (actually, so is the second - HIGH and LOW are just #defined as 1 and 0 respectively).
in digitalWrite() and the related functions, Arduino looks up what pin that number corresponds to. The defines like D0~D13 are just #defined as 0~13, likewise A0~A5 are #defined as 14~19. (analogRead() will take either the 14~19 values, or 0~5 - it's smart enough to figure out which you've given it).
These are all just numbers - it's what you do with them that gives them meaning
Hell, you can even do stuff like pinMode(13,1); (INPUT, OUTPUT, INPUT_PULLUP are defines - I forget which is which) - though you shouldn't, as that just makes your code harder to read.