Find the sum of the first Nth Centered Tridecagonal Numbers | Function to calculate the N - th centered tridecagonal number ; Formula to calculate Nth centered tridecagonal number & return it ; Function to find the sum of the first N centered tridecagonal numbers ; Variable to store the sum ; Loop to iterate and find the sum of first N centered tridecagonal numbers ; Driver code
function Centered_tridecagonal_num ( n ) { return ( 13 * n * ( n - 1 ) + 2 ) / 2 ; } function sum_Centered_tridecagonal_num ( n ) { let summ = 0 ; for ( let i = 1 ; i <= n ; i ++ ) { summ += Centered_tridecagonal_num ( i ) ; } return summ ; } let n = 5 ; document . write ( sum_Centered_tridecagonal_num ( n ) ) ;