Super | Python3 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
import math NEW_LINE def findDivisors ( n ) : NEW_LINE INDENT divisors = [ ] NEW_LINE for i in range ( 1 , int ( math . sqrt ( n ) + 1 ) ) : NEW_LINE INDENT if ( n % i == 0 ) : NEW_LINE INDENT if ( n / i == i ) : NEW_LINE INDENT divisors . append ( i ) NEW_LINE DEDENT else : NEW_LINE INDENT divisors . append ( i ) NEW_LINE divisors . append ( int ( n / i ) ) NEW_LINE DEDENT DEDENT DEDENT return sorted ( divisors ) NEW_LINE DEDENT def isSuperdNum ( n ) : NEW_LINE INDENT d = findDivisors ( n ) NEW_LINE for i in d : NEW_LINE INDENT x = ( 2 ** i - 2 ) / i NEW_LINE if int ( x ) != x : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT return True NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 341 NEW_LINE if isSuperdNum ( n ) == True : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT