Theory of why this doesn't really work?

char* test1( unsigned long a )
{
  char s[13]; //under 13 = arduino reset
  sprintf(s,"<%lu>", a);
  return s;
}

Outside test1 the variable "s" is out of scope. It crashes because you are writing over the stack when you attempt to use it.

(edit) And out of lifetime. The scope and lifetime of "s" is inside that function only.