Gasp ! I'm really bored and wrote a short C code to test the results. It's confirmed 31 ! Compile and test it for yourself !


#include <stdio.h>

int main()
{
int i, j, total=0, switches[1001] = {0} ;

for (i=1; i<1001; i++) {
for (j=i; j<1001; j+=i ) {
switches[j]^=0x1 ;
}
}

for (i=1; i<1001; i++) {
total += switches[i] ;
}

printf ("\n\nTotal switched on lightbulbs is %d\n\n", total ) ;

return 0;
}