Exemplo n.º 1
0
 public static Triangular ClosestTriangularNumber(long value)
 {
     // Triangular numbers of order n is also the summation of natural numbers up to n.
     // So the anti-summation will give us the order of the closest triangular number.
     // Then re-doing the summation gives us the triangular number.
     return(new Triangular(value.AntiSummation()));
 }