kill(all)$

van=facebook.com/LearningCalculus$

P(x,m):=6*x^4-7*x^3+m*x^2+3*x+2;

Q(x,n):=x^2-x+n;

L:12$
count:0$

for m: -L thru L do
    for n: -L thru L do
    (
        remainder: second(divide(P(x,m),Q(x,n),x)),
        if remainder = 0 then
        (
            print
            (
                "Answer m: ", m, 
                       "  n: ", n, 
                       "  P: ", P(x,m),
                       "  Q: ", Q(x,n)
            ),
            print
            (
                "Answer P|Q: ",first(divide(P(x,m),Q(x,n),x))
            )
        ),
        count: count+1
    )$
print("Answer Examined ", count, " cases")$

L:200$
count:0$

for m: -L thru L do
    for n: -L thru L do
    (
        remainder: second(divide(Q(x,n),P(x,m),x)),
        if remainder = 0 then
        (
            print
            (
                "Answer m: ", m, 
                       "  n: ", n, 
                       "  P: ", P(x,m),
                       "  Q: ", Q(x,n)
            ),
            print
            (
                "Answer P|Q: ",first(divide(Q(x,n),P(x,m),x))
            )
        ),
        count: count+1
    )$
print("Answer Examined ", count, " cases")$