Gifted kids are all really different in their specific strengths. That said, for one with a well-expressed nerd gene, we started at age 6. I would start with an iPad app (slightly simpler container than a browser), maybe that gamifies the whole thing a bit with some easy on-ramps. For us that was Tynker and a bit of Hopscotch. It's pretty easy to tell whether you've got any sparks of interest on your hands, else no point in pushing it.