I'm trying to figure out how the modulo operation works using long division with negative dividends.
I know that $-1 \bmod 10 = 9$. But I can't figure out why.
For positive dividends, it's relatively straightforward.
$1 \bmod 10$ is the remainder of the long division of $1 ÷ 10$, which is $1$.
But when I try to find the remainder of the long division of $-1 ÷ 10$, I get $-1$, not $9$.
What am I doing wrong or failing to grasp?