uno output erratic even with simple for loop output test

Well what happens is that your condition to continue the loop 1 <= 13 is always true so your variable i keeps incrementing super fast past 13 and issues the digitalWrite which do nothing on pins that do not exist. This for loop never ends and your loop never loops

Int are signed numbers coded on 2 bytes on your UNO, so after a while your int reaches 32,767 And then overflows and becomes negative at -32,768, then keeps growing and hit again 0 after a while.

So your i does

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 32767 -32768 -32767 .... -1 0 1 2 ...

Given the delay it takes a while to do the full circle (note that 14 15 etc are valid and refer to the analog pins so you mess around with those too)