fixed. now works for n=4000000