Program to check if N is a Centered heptagonal number | Java implementation to check that a number is a Centered heptagonal number or not ; Function to check that the number is a Centered heptagonal number ; Condition to check if the number is a Centered heptagonal number ; Driver Code ; Function call
import java . lang . Math ; class GFG { public static boolean isCenteredheptagonal ( int N ) { double n = ( 7 + Math . sqrt ( 56 * N - 7 ) ) / 14 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int n = 8 ; if ( isCenteredheptagonal ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }