Program to check if N is a Centered Pentagonal Number or not | Python3 program for the above approach ; Function to check if number N is a centered pentagonal number ; Condition to check if N is a centered pentagonal number ; Given Number ; Function call
import numpy as np NEW_LINE def isCenteredpentagonal ( N ) : NEW_LINE INDENT n = ( 5 + np . sqrt ( 40 * N - 15 ) ) / 10 NEW_LINE return ( n - int ( n ) ) == 0 NEW_LINE DEDENT N = 6 NEW_LINE if ( isCenteredpentagonal ( N ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT