Super | C # implementation to check if N is a super Poulet number ; Function to find the divisors ; Loop to iterate over the square root of the N ; Check if divisors are equal ; Function to check if N is a super Poulet number ; Loop to check that every divisor divides 2 ^ D - 2 ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static List < int > findDivisors ( int n ) { List < int > divisors = new List < int > ( ) ; for ( int i = 1 ; i < ( Math . Sqrt ( n ) + 1 ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) divisors . Add ( i ) ; else { divisors . Add ( i ) ; divisors . Add ( ( n / i ) ) ; } } } divisors . Sort ( ) ; return divisors ; } static bool isSuperdNum ( int n ) { List < int > d = findDivisors ( n ) ; foreach ( int i in d ) { double x = ( Math . Pow ( 2 , i ) - 2 ) / i ; if ( Math . Truncate ( x ) != x ) return false ; } return true ; } public static void Main ( string [ ] args ) { int n = 341 ; if ( isSuperdNum ( n ) == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }