hermann on Mon, 18 Nov 2024 13:18:50 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Is there a function for sum of square matrix antidiagonal like "trace()" for main diagonal?


I used below code, is there something shorter?

  assert(isprime(trace(ps)));
  assert(isprime(vecsum([ps[i,#ps+1-i]|i<-[1..#ps]])));

Regards,

Hermann.