Chiliagon Number | Java program for the above approach ; Finding the nth chiliagon number ; Driver code
class GFG { static int chiliagonNum ( int n ) { return ( 998 * n * n - 996 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( "3rd ▁ chiliagon ▁ Number ▁ is ▁ = ▁ " + chiliagonNum ( n ) ) ; } }