Global variables are horrible, dirty, nasty things. Read why here:
Global Variables Are Bad. You should make them locals and pass them around, so your code is easier to debug. Also, try a better
indentation style, that will make it easier to understand what pieces of code belong in what blocks.
Now, as for your problem, this is speculative because I didn't feel like waiting for my computer to run billions upon billions of calculations. I think the reason your program crashes is that you are overflowing i, so it wraps around to a negative number, then, when you access S[i], you cause a seg fault (negative indexes are bad, especially really big ones). As for why you're overflowing, I think your humbleTest function isn't quite correct. If I understand the algorithm correctly, it should look something like this:
Code:
for each element in S
while num % S[i] == 0 // while loop accounts for numbers that are comprised of, e.g. p1p1
num /= S[i]
if num == 1 // if there are no prime factors left (i.e. all num's prime factors are in S)
return humble number