Centered pentagonal number | centered pentagonal number function ; Formula to calculate nth Centered pentagonal number and return it into main function . ; Driver Code
function centered_pentagonal_Num ( n ) { return ( 5 * n * n - 5 * n + 2 ) / 2 ; } var n = 7 ; document . write ( n + " " + " " ) ; document . write ( centered_pentagonal_Num ( n ) ) ;