// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class MathVector {
   private int[] v;
   public MathVector(int n) {
       v = new int[n];
   }
   public MathVector(int[] v) {
      this.v = v;
   }
   public MathVector add(int k) {
       int[] res = new int[v.length];
       for(int i = 0; i < v.length; i++) res[i] = v[i] + k;
       return new MathVector(res);
   }
   public MathVector sub(int k) {
       int[] res = new int[v.length];
       for(int i = 0; i < v.length; i++) res[i] = v[i] - k;
       return new MathVector(res);
   }
   public MathVector mul(int k) {
       int[] res = new int[v.length];
       for(int i = 0; i < v.length; i++) res[i] = v[i] * k;
       return new MathVector(res);
   }
   public MathVector div(int k) {
       int[] res = new int[v.length];
       for(int i = 0; i < v.length; i++) res[i] = v[i] / k;
       return new MathVector(res);
   }
   public MathVector mod(int k) {
       int[] res = new int[v.length];
       for(int i = 0; i < v.length; i++) res[i] = v[i] - (v[i]/k)*k;
       return new MathVector(res);
   }
   public int size() {
       return v.length;
   }
   public int[] getV() {
       return v;
   }
}
