Hi.

The result of x%y is the numerator, of the fraction, which is the remainder of doing x/y. 1000%7=6 because 1000/7 = 142.857142857 = 142+0.857142857 = 142+6/7.

The thought process changes with negative numbers. To understand why (-1)&7=6, have a read of the answer by Peter Vanroose in https://www.quora.com/How-does-the-modulo-operation-work-with-negative-numbers-and-why

A way of thinking, which unifies positive and negative numbers, is to continuously minus, (or add, if it's a negative number), y from (or to, if it's a negative number) x until you get the lowest positive number. In 1000 % 7 = 6 = (-1) % 7, if you continuously minus 7 from 1000, you'll eventually get to 6. If you add 7 to -1, you get 6.

I hope that makes sense :)