This is a special post for quick takes by TurnTrout. Only they can create top-level comments. Comments here also appear on the Quick Takes page and All Posts page.
A few days, as you forgot to include medication. Barring that issue, I think the lack of internet access and no materials is killer. My local library kind of sucks in terms of stimulating materials. So maybe a few weeks? A month or two, at most. If I had my latpop with me, but without internet access, then maybe a year or two. If I had some kind of magical internet access allowing me to interface with stuff like ChatGPT, then maybe a few more years, as I could probably cook up a decent chatbot to meet some socialization needs. I very much doubt I could spend more than ten years without my values drifting off.
I would ask for a long time.
Reading would probably get boring after a few decades, but I think writing essays and programs and papers and books could last much longer. Meditation could also last long, because I'm bad at it.
<1000 years, though; I'd need to be relatively sure I wouldn't commit suicide or fall down stairs.
1FactorialCode
Probably 3-5 years then. I'd use it to get a stronger foundation in low level programming skills, math and physics. The limiting factors would be entertainment in the library to keep me sane and the inevitable degradation of my social skills from so much spent time alone.