Octahedral Number | Function to find octahedral number ; Formula to calculate nth octahedral number and return it into main function . ; Drivers Code ; print result
function octahedral_num ( n ) { return n * ( 2 * n * n + 1 ) / 3 ; } let n = 5 ; document . write ( n + " " ) ; document . write ( octahedral_num ( n ) ) ;