Find the permutation of first N natural numbers such that sum of i % Pi is maximum possible | Function to find the permutation of the first N natural numbers such that the sum of ( i % Pi ) is maximum possible and return the maximum sum ; Driver code ; Function call
function Max_Sum ( n ) { return parseInt ( ( n * ( n - 1 ) ) / 2 ) ; } let n = 8 ; document . write ( Max_Sum ( n ) ) ;