p[i_,j_,n_]:=Sum[n-k,{k,0,i-1}]+j-i

p[i,j,n]
(* The following is the original implementation in scitbx/array_family/accessors/packed_matrix.h for packed_u 
*)
p[i,j,n]==i(n-1)-i(i-1)/2+j//Simplify

(* This is a simpler formula with less ops *)
p1[i_,j_,n_]:=(2n-1-i)i/2+j

p1[i,j,n]==p[i,j,n]//Simplify

(* This is the original implementation in  scitbx/array_family/accessors/packed_matrix.h for packed_l 
Already simplest possible 
*)
q[i_,j_,n_]:=Sum[k,{k,1,i}]+j

q[i,j,n]