kill(all)$

van=facebook.com/LearningCalculus$

      N: [n1, n2, n3] are the number of pens, pencils and erasers.
      C: [c1, c2, c3] are the costs  of pens, pencils and erasers.
      T: total cost
  

f(N,C,T):=N.C=T$

costGreaterBy(N,C):= [[N[1],N[2]].[C[1],C[2]]>N[3]*C[3],
                      [N[1],N[2]].[C[1],C[2]]-N[3]*C[3]]$

i:1$ s:[]$ g:[]$
for a:-10 thru 10 step 1/4 do
    for b:-5 thru 5 step 1/4 do
        for c:-7 thru 7 step 1/4 do
            if f([3,2,6],[a,b,c],23) and f([2,5,1],[a,b,c],12) then
            (
                s: append(s,[[a,b,c]]),
                g: append(g,[costGreaterBy([4,21,7],[a,b,c])]),
                i:i+1
            )$

      s is the cost vector of vectors
      g is the cost greater by vector of vectors for each vector in s

s;

g;

      The cost of 4 pens and 21 pencils is Rs.14 greater than the cost of 7 erasers.