Simple minimal change
So, I'm not going to tell you that this is a good idea, but a minimal change would be to static qualify this as static unsigned int number[8199]; Then you won't get that reset cause, here, for this reason.
Some details for anyone curious
If you want to see some of the guts, you look in the ESP32 core for Arduino where it creates the task that ultimately runs setup() for you. You can see that it calls getArduinoLoopTaskStackSize() returning ARDUINO_LOOP_STACK_SIZE which by default is 8192. 8192 bytes, not unsigned ints. With sizeof(unsigned int) being 4, this is very roughly in the vicinity of the 1800 unsigned ints where things started to fall apart in my testing above. Rather than chase down the configurion I just made a sketch that does Serial.println(getArduinoLoopTaskStackSize()); and yeah, it prints 8192.
getArduinoLoopTaskStackSize is a weakly defined function which would allow something to redefine in elsewhere in the program to overload the default one. So, just out of curiosity I wrote one as follows:
size_t getArduinoLoopTaskStackSize(void) {
size_t r_size = sizeof(unsigned int [8199]); // exactly the size your array
r_size += r_size >> 3; // add about 1/8 (or 12.5%) extra
return r_size;
}
It no longer crashes. Should you do this? Probably not. But, if you ever have a legitimate reason to put a 32K array on the stack on an ESP32 it may be an option. I mostly just did this to see what would happen. It's barely been tested.