I don't see you assigning a value to "n" in the IsPrime function.

Should "n = arg?"

Or do you want to use "arg - 1" instead of "n - 1?"