kill(all)$

van=facebook.com/LearningCalculus$

n:2016$

isMultipleOf(a,b):= if mod(a,b)=0 then true else false;

pairs:0;

for a: 0 thru n do
    for b: 0 thru n do
        if isMultipleOf(a,b+1) and isMultipleOf(2016-a,b)
            then pairs: pairs+1;

pairs;