Centered Octagonal Number | Centered octagonal number function ; Formula to calculate nth centered octagonal number & return it into main function . ; Driver Code
< ? php function cen_octagonalnum ( $ n ) { return ( 4 * $ n * $ n - 4 * $ n + 1 ) ; } $ n = 6 ; echo $ n , " th ▁ centered " , " ▁ octagonal ▁ number ▁ : ▁ " ; echo cen_octagonalnum ( $ n ) ; echo " STRNEWLINE " ; $ n = 11 ; echo $ n , " th ▁ centered " , " ▁ octagonal ▁ number ▁ : ▁ " ; echo cen_octagonalnum ( $ n ) ; ? >