dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def power ( a , b ) :
    if ( b == 0 ) :
        return 1 ;
    if ( b == 1 ) :
        return a ;
    tmp = power ( a , b // 2 ) ;
    result = tmp * tmp ;
    if ( b % 2 == 1 ) :
        result *= a ;
    return result ;
def check ( n ) :
    temp = n ;
    while ( temp > 0 ) :
        last_digit = temp % 10 ;
        if ( last_digit == 0 or last_digit == 1 ) :
            return False ;
        if ( n % last_digit == 0 ) :
            return False ;
        temp = temp // 10 ;
    return True ;
def solve ( n ) :
    L = power ( 10 , n - 1 ) ;
    R = power ( 10 , n ) - 1 ;
    flag = 0 ;
    for i in range ( L , R + 1 ) :
        answer = check ( i ) ;
        if ( answer ) :
            print ( i )
            flag += 1 ;
            break ;
    if ( flag == 0 ) :
        print ( - 1 )
if __name__ == " _ _ main _ _ " :
    N = 4 ;
    solve ( N ) ;

Accumulator variables: flag
Iterator variables: i
Python program:
def costOfSubsequence ( N , arr , costArray ) :
    i , temp , cost = 0 , 0 , 0
    removedElements = { ' ' }
    ans = 0
    for i in range ( 1 , N - 1 ) :
        temp = arr [ i ]
        if ( ( ( arr [ i - 1 ] < temp ) and ( temp < arr [ i + 1 ] ) ) or ( ( arr [ i - 1 ] > temp ) and ( temp > arr [ i + 1 ] ) ) ) :
            removedElements . add ( temp )
    for i in range ( 0 , N ) :
        temp = arr [ i ]
        if ( temp not in removedElements ) :
            ans = ans + arr [ i ]
        else :
            cost += costArray [ i ]
    print ( ans , end = " , ▁ " )
    print ( cost )
N = 4
arr = [ 1 , 3 , 4 , 2 ]
costArray = [ 0 , 1 , 0 , 0 ]
costOfSubsequence ( N , arr , costArray )

Index/key variables: i
Accumulator variables: cost, removedElements
Iterator variables: i
Python program:
def find_Xor ( arr , query , N , Q ) :
    for i in range ( 1 , N ) :
        arr [ i ] = arr [ i ] ^ arr [ i - 1 ]
    ans = 0
    for i in range ( Q ) :
        if query [ i ] [ 0 ] == 0 :
            ans = arr [ query [ i ] [ 1 ] ]
        else :
            ans = ( arr [ query [ i ] [ 0 ] - 1 ] ^ arr [ query [ i ] [ 1 ] ] )
        print ( ans )
def main ( ) :
    arr = [ 3 , 2 , 4 , 5 , 1 , 1 , 5 , 3 ]
    N = 8
    Q = 2
    query = [ [ 1 , 4 ] , [ 3 , 7 ] ]
    find_Xor ( arr , query , N , Q )
main ( )

Index/key variables: i
Iterator variables: i
Python program:
def DiStirngMatch ( Str ) :
    N = len ( Str )
    arr = ( N + 1 ) * [ 0 ]
    START , END = 0 , N
    for i in range ( N ) :
        if ( Str [ i ] == ' I ' ) :
            arr [ i ] = START
            START += 1
        if ( Str [ i ] == ' D ' ) :
            arr [ i ] = END
            END -= 1
    arr [ N ] = START
    return arr
if __name__ == " _ _ main _ _ " :
    Str = " IDID "
    N = len ( Str )
    ptr = DiStirngMatch ( Str )
    for i in range ( N + 1 ) :
        print ( ptr [ i ] , end = " ▁ " )

Index/key variables: N, i
Accumulator variables: END, START
Iterator variables: i
Python program:
import math
def IsPrime ( i ) :
    if ( i % 2 == 0 and i != 2 ) :
        return 0 ;
    else :
        for j in range ( 3 , int ( math . sqrt ( i ) + 1 ) , 2 ) :
            if ( i % j == 0 ) :
                return 0 ;
        return 1 ;
c = 0 ;
N = 72 ;
for i in range ( 2 , int ( math . sqrt ( N ) ) + 1 ) :
    if ( IsPrime ( i ) ) :
        if ( N % i == 0 ) :
            c = c + 1
            if ( IsPrime ( N / i ) and i != ( N / i ) ) :
                c = c + 1
print ( pow ( 2 , c ) - 1 )

Iterator variables: i, j
Python program:
def find_seq ( arr , m , n ) :
    b = [ ]
    x = 0
    b . append ( x )
    for i in range ( n - 1 ) :
        b . append ( x + arr [ i ] + b [ i ] )
    mn = n
    for i in range ( n ) :
        mn = min ( mn , b [ i ] )
    x = 1 - mn
    for i in range ( n ) :
        b [ i ] += x
    for i in range ( n ) :
        print ( b [ i ] , end = ' ▁ ' )
    print ( )
if __name__ == ' _ _ main _ _ ' :
    N = 3
    arr = [ - 2 , 1 ]
    M = len ( arr )
    find_seq ( arr , M , N )

Index/key variables: i
Accumulator variables: b
Iterator variables: i
Python program:
import math
def isEqualFactors ( N ) :
    ev_count = 0
    od_count = 0
    for i in range ( 1 , ( int ) ( math . sqrt ( N ) ) + 2 ) :
        if ( N % i == 0 ) :
            if ( i == N // i ) :
                if ( i % 2 == 0 ) :
                    ev_count += 1
                else :
                    od_count += 1
            else :
                if ( i % 2 == 0 ) :
                    ev_count += 1
                else :
                    od_count += 1
                if ( ( N // i ) % 2 == 0 ) :
                    ev_count += 1 ;
                else :
                    od_count += 1 ;
    if ( ev_count == od_count ) :
        print ( " YES " )
    else :
        print ( " NO " )
N = 10
isEqualFactors ( N )

Accumulator variables: ev_count, od_count
Iterator variables: i
Python program:
def count_crazy_primes ( L , R ) :
    prime = [ 0 ] * ( R + 1 )
    countPrime = [ 0 ] * ( R + 1 )
    freqPrime = [ 0 ] * ( R + 1 )
    prime [ 0 ] = prime [ 1 ] = 1
    p = 2
    while p * p <= R :
        if ( prime [ p ] == 0 ) :
            for i in range ( p * p , R + 1 , p ) :
                prime [ i ] = 1
        p += 1
    for i in range ( 1 , R + 1 ) :
        countPrime [ i ] = countPrime [ i - 1 ]
        if ( not prime [ i ] ) :
            countPrime [ i ] += 1
    for i in range ( 1 , R + 1 ) :
        freqPrime [ i ] = freqPrime [ i - 1 ]
        if ( not prime [ countPrime [ i ] ] ) :
            freqPrime [ i ] += 1
    return ( freqPrime [ R ] - freqPrime [ L - 1 ] )
if __name__ == " _ _ main _ _ " :
    L = 4
    R = 12
    print ( count_crazy_primes ( L , R ) )

Index/key variables: R, i, p
Iterator variables: i
Python program:
def maximizedArray ( arr , N ) :
    i = 0
    while ( N > 0 ) :
        num = arr [ i ]
        one = 0
        zero = 0
        while ( num ) :
            if ( num % 2 == 0 ) :
                zero += 1
            else :
                one += 1
            num = num >> 1
        for j in range ( zero , ( one + zero ) ) :
            num += ( 1 << j )
        print ( num , end = " " )
        i += 1
        if ( N > 0 ) :
            print ( " , ▁ " , end = " " )
        N -= 1
if __name__ == " _ _ main _ _ " :
    arr = [ 8 , 15 , 9 , 10 , 14 ]
    N = len ( arr )
    maximizedArray ( arr , N )

Index/key variables: i
Accumulator variables: N, num, one, zero
Iterator variables: j
Python program:
import math
def findGCD ( arr , n ) :
    gcd = arr [ 0 ]
    for i in range ( 1 , n ) :
        gcd = int ( math . gcd ( arr [ i ] , gcd ) )
        if ( gcd == 1 ) :
            return 1
    return gcd
def findLCM ( arr , n ) :
    lcm = arr [ 0 ]
    for i in range ( 1 , n ) :
        lcm = int ( ( ( ( arr [ i ] * lcm ) ) / ( math . gcd ( arr [ i ] , lcm ) ) ) )
    return lcm
def findRatio ( arr , n ) :
    gcd = findGCD ( arr , n )
    lcm = findLCM ( arr , n )
    print ( int ( lcm / gcd ) , " : " , "1" )
arr = [ 6 , 12 , 36 ]
N = len ( arr )
findRatio ( arr , N )

Index/key variables: i
Iterator variables: i
Python program:
from collections import defaultdict
def compute ( a , N , K ) :
    eqVal = defaultdict ( int )
    maxX = 0
    for i in range ( N ) :
        val = a [ i ] % K
        if ( val != 0 ) :
            val = K - val
        if ( val == 0 ) :
            continue
        if ( val in eqVal ) :
            numVal = eqVal [ val ]
            maxX = max ( maxX , val + ( K * numVal ) )
            eqVal [ val ] += 1
        else :
            eqVal [ val ] += 1
            maxX = max ( maxX , val )
    if maxX == 0 :
        print ( 0 )
    else :
        print ( maxX + 1 )
if __name__ == " _ _ main _ _ " :
    K = 3
    a = [ 1 , 2 , 2 , 18 ]
    N = len ( a )
    compute ( a , N , K )

Index/key variables: i, val
Iterator variables: i
Python program:
def sumOfTheArrayForQuery ( A , N , X , Y , Q ) :
    sum = 0
    count = { }
    for i in range ( N ) :
        sum += A [ i ]
        if A [ i ] in count :
            count [ A [ i ] ] += 1
        else :
            count [ A [ i ] ] = 1
    for i in range ( Q ) :
        x = X [ i ]
        y = Y [ i ]
        if X [ i ] not in count :
            count [ X [ i ] ] = 0
        if Y [ i ] not in count :
            count [ Y [ i ] ] = 0
        sum -= ( count [ X [ i ] ] * X [ i ] )
        sum += count [ X [ i ] ] * Y [ i ]
        count [ Y [ i ] ] += count [ X [ i ] ]
        count [ X [ i ] ] = 0
        print ( sum , end = " ▁ " )
arr = [ 1 , 2 , 1 , 3 , 2 , ]
X = [ 2 , 3 , 5 ]
Y = [ 3 , 1 , 2 ]
N = len ( arr )
Q = len ( X )
sumOfTheArrayForQuery ( arr , N , X , Y , Q )

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Python program:
def printArr ( arr , n ) :
    for i in range ( n ) :
        print ( arr [ i ] , end = " ▁ " )
def IncrementFactors ( count , val ) :
    i = 1
    while ( i * i <= val ) :
        if ( val % i == 0 ) :
            if ( i == val // i ) :
                count [ i ] += 1
            else :
                count [ i ] += 1
                count [ val // i ] += 1
        i += 1
def generateArr ( A , n ) :
    B = [ 0 ] * n
    maxi = max ( A )
    count = [ 0 ] * ( maxi + 1 )
    for i in range ( n ) :
        B [ i ] = count [ A [ i ] ]
        IncrementFactors ( count , A [ i ] )
    printArr ( B , n )
arr = [ 8 , 1 , 28 , 4 , 2 , 6 , 7 ]
n = len ( arr )
generateArr ( arr , n )

Index/key variables: i
Iterator variables: i
Python program:
def SieveOfEratosthenes ( n ) :
    prime = [ True for i in range ( 2 * n + 1 ) ]
    p = 2
    while ( p * p <= 2 * n ) :
        if ( prime [ p ] == True ) :
            i = p * p
            while ( i <= n * 2 ) :
                prime [ i ] = False
                i += p
        p += 1
    primes = [ ]
    for p in range ( 2 , ( 2 * n ) + 1 ) :
        if ( prime [ p ] ) :
            primes . append ( p )
    return primes
def minChanges ( arr ) :
    n = len ( arr )
    ans = 0
    maxi = max ( arr )
    primes = SieveOfEratosthenes ( maxi )
    for i in range ( n ) :
        x = - 1
        for j in range ( len ( primes ) ) :
            if ( arr [ i ] == primes [ j ] ) :
                x = j
                break
            elif ( arr [ i ] < primes [ j ] ) :
                x = j
                break
        minm = abs ( primes [ x ] - arr [ i ] )
        if ( x > 1 ) :
            minm = min ( minm , abs ( primes [ x - 1 ] - arr [ i ] ) )
        ans += minm
    return ans
arr = [ 4 , 25 , 13 , 6 , 20 ]
print ( minChanges ( arr ) )

Index/key variables: i, j, p, x
Accumulator variables: ans, primes
Iterator variables: i, j, p
Python program:
def calcSum ( k , n ) :
    value = ( k * n * ( n + 1 ) ) // 2
    return value
def findSum ( a , n , L , R ) :
    sum = 0
    for i in range ( n ) :
        if ( L % a [ i ] == 0 and L != 0 ) :
            sum += ( calcSum ( a [ i ] , R // a [ i ] ) - calcSum ( a [ i ] , ( L - 1 ) // a [ i ] ) )
        else :
            sum += ( calcSum ( a [ i ] , R // a [ i ] ) - calcSum ( a [ i ] , L // a [ i ] ) )
    return sum ;
if __name__ == " _ _ main _ _ " :
    arr = [ 2 , 7 , 3 , 8 ]
    N = len ( arr )
    L = 7
    R = 20
    print ( findSum ( arr , N , L , R ) )

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Python program:
def isDivBySubsetSums ( arr , num ) :
    n = len ( arr )
    total = 1 << n
    i = 0
    while i < total :
        sum = 0
        j = 0
        while j < n :
            if ( i & ( 1 << j ) ) :
                sum += arr [ j ]
            j += 1
        if ( sum != 0 ) and ( num % sum != 0 ) :
            return False
        i += 1
    return True
def isSuperNivenNum ( n ) :
    temp = n
    digits = [ ]
    while ( n > 1 ) :
        digit = int ( n ) % 10
        digits . append ( digit )
        n = n / 10
    return isDivBySubsetSums ( digits , temp )
if __name__ == ' _ _ main _ _ ' :
    n = 500
    if isSuperNivenNum ( n ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: j
Accumulator variables: digits, i, sum
Python program:
def divCount ( n ) :
    Hash = [ True for i in range ( n + 1 ) ]
    p = 2
    while ( ( p * p ) < n ) :
        if bool ( Hash [ p ] ) :
            i = p * 2
            while i < n :
                Hash [ i ] = False
                i += p
        p += 1
    total = 1
    for P in range ( 2 , n + 1 ) :
        if ( bool ( Hash [ P ] ) ) :
            count = 0
            if ( n % P == 0 ) :
                while ( n % P == 0 ) :
                    n = n // P
                    count += 1
                total = total * ( count + 1 )
    return total
def isHighlyCompositeNumber ( N ) :
    NdivCount = divCount ( N )
    for i in range ( N ) :
        idivCount = divCount ( i )
        if ( idivCount >= NdivCount ) :
            return bool ( False )
    return bool ( True )
N = 12
if ( bool ( isHighlyCompositeNumber ( N ) ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Index/key variables: P, i, p
Accumulator variables: count
Iterator variables: P, i
Python program:
def isSaintExuperyNum ( n ) :
    for i in range ( 1 , ( n // 3 ) + 1 ) :
        for j in range ( i + 1 , ( n // 2 ) + 1 ) :
            k = n / i / j
            if i * i + j * j == k * k :
                if i * j * k == n :
                    return True
    return False
N = 60
if isSaintExuperyNum ( N ) :
    print ( " Yes " )
else :
    print ( " No " )

Iterator variables: i, j
Python program:
def isRepdigit ( num , b ) :
    prev = - 1
    while ( num ) :
        digit = num % b
        num //= b
        if ( prev != - 1 and digit != prev ) :
            return False
        prev = digit
    return True
num = 2000
base = 7
if ( isRepdigit ( num , base ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Accumulator variables: num
Python program:
import math
def isComposite ( n ) :
    if n <= 3 :
        return False
    if ( n % 2 == 0 or n % 3 == 0 ) :
        return True
    i = 5
    while ( i * i <= n ) :
        if ( n % i == 0 or n % ( i + 2 ) == 0 ) :
            return True
        i = i + 6
    return False
def concatenatePrimeFactors ( n ) :
    concatenate = " "
    if ( n % 2 == 0 ) :
        concatenate += "2"
        while ( n % 2 == 0 ) :
            n = int ( n / 2 )
    i = 3
    while ( i <= int ( math . sqrt ( n ) ) ) :
        if ( n % i == 0 ) :
            concatenate += str ( i )
            while ( n % i == 0 ) :
                n = int ( n / i )
        i = i + 2
    if ( n > 2 ) :
        concatenate += str ( n )
    return concatenate
def isEnlightened ( N ) :
    if ( not isComposite ( N ) ) :
        return False
    num = str ( N )
    prefixConc = concatenatePrimeFactors ( N )
    return int ( prefixConc )
if __name__ == " _ _ main _ _ " :
    n = 250
    if ( isEnlightened ( n ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: concatenate
Python program:
def isIdoneal ( n ) :
    for a in range ( 1 , n + 1 ) :
        for b in range ( a + 1 , n + 1 ) :
            for c in range ( b + 1 , n + 1 ) :
                if ( a * b + b * c + c * a == n ) :
                    return False
    return True
N = 10
if ( isIdoneal ( N ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Iterator variables: a, b, c
Python program:
import math
def checkDivisibility ( n , digit ) :
    return ( ( digit != 0 ) and ( ( n % digit ) == 0 ) )
def isAllDigitsDivide ( n ) :
    temp = n
    while ( temp >= 1 ) :
        digit = int ( temp % 10 )
        if ( checkDivisibility ( n , digit ) == False ) :
            return 0
        temp = temp / 10
    return 1
def isAllDigitsDistinct ( n ) :
    arr = [ 0 ] * 10
    while ( n >= 1 ) :
        digit = int ( n % 10 )
        if ( arr [ digit ] ) :
            return 0
        arr [ digit ] = 1
        n = int ( n / 10 )
    return 1
def isLynchBell ( n ) :
    return ( isAllDigitsDivide ( n ) and isAllDigitsDistinct ( n ) )
if __name__ == ' _ _ main _ _ ' :
    N = 12
    if isLynchBell ( N ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: digit
Python program:
def isRepunitNum ( n , b ) :
    length = 0 ;
    countOne = 0 ;
    while ( n != 0 ) :
        r = n % b ;
        length += 1 ;
        if ( r == 1 ) :
            countOne += 1 ;
        n = n // b ;
    return countOne >= 3 and countOne == length ;
if __name__ == ' _ _ main _ _ ' :
    n = 31 ;
    base = 2 ;
    if ( isRepunitNum ( n , base ) ) :
        print ( " Yes " ) ;
    else :
        print ( " No " ) ;

Accumulator variables: countOne, length
Python program:
import math
MAX = 10000
primes = [ ]
def sieveSundaram ( ) :
    marked = [ 0 ] * ( MAX // 2 + 1 )
    for i in range ( 1 , ( int ( math . sqrt ( MAX ) ) - 1 ) // 2 + 1 ) :
        j = ( i * ( i + 1 ) ) << 1
        while ( j <= MAX // 2 ) :
            marked [ j ] = True
            j = j + 2 * i + 1
    primes . append ( 2 )
    for i in range ( 1 , MAX // 2 + 1 ) :
        if ( marked [ i ] == False ) :
            primes . append ( 2 * i + 1 )
def isEconomical ( n ) :
    if ( n == 1 ) :
        return False
    original_no = n
    sumDigits = 0
    while ( original_no > 0 ) :
        sumDigits += 1
        original_no = original_no // 10
    pDigit = 0
    count_exp = 0
    i = 0
    p = 0
    while ( primes [ i ] <= n // 2 ) :
        while ( n % primes [ i ] == 0 ) :
            p = primes [ i ]
            n = n // p
            count_exp += 1
        i += 1
        while ( p > 0 ) :
            pDigit += 1
            p = p // 10
        while ( count_exp > 1 ) :
            pDigit += 1
            count_exp = count_exp // 10
    if ( n != 1 ) :
        while ( n > 0 ) :
            pDigit += 1
            n = n // 10
    if ( pDigit < sumDigits ) :
        return True
    return False
sieveSundaram ( )
for i in range ( 1 , 200 ) :
    if ( isEconomical ( i ) ) :
        print ( i , end = " ▁ " )

Index/key variables: i, j
Accumulator variables: count_exp, pDigit, primes, sumDigits
Iterator variables: i
Python program:
prime = [ ]
def buildSieve ( sum ) :
    global prime
    prime = [ True for i in range ( sum + 1 ) ]
    prime [ 0 ] = False
    prime [ 1 ] = False
    p = 2
    while ( p * p < ( sum + 1 ) ) :
        if ( prime [ p ] ) :
            for i in range ( p * 2 , sum + 1 , p ) :
                prime [ i ] = False
        p += 1
def getSum ( a ) :
    s = 0
    for i in range ( 4 ) :
        for j in range ( 5 ) :
            s += a [ i ] [ j ]
    return s
def checkIndex ( n , m , a ) :
    for i in range ( n ) :
        for j in range ( m ) :
            if ( prime [ i + j ] and not prime [ a [ i ] [ j ] ] ) :
                return False
    return True
if __name__ == " _ _ main _ _ " :
    n = 4
    m = 5
    a = [ [ 1 , 2 , 3 , 2 , 2 ] , [ 2 , 2 , 7 , 7 , 7 ] , [ 7 , 7 , 21 , 7 , 10 ] , [ 2 , 2 , 3 , 6 , 7 ] ]
    sum = getSum ( a )
    buildSieve ( sum )
    if ( prime [ sum ] and checkIndex ( n , m , a ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i, j, p, sum
Accumulator variables: s
Iterator variables: i, j
Python program:
mod = 1000000007
lis = [ [ ] for i in range ( 100001 ) ]
primes = [ ]
vis = [ 0 for i in range ( 100001 ) ]
dis = [ 0 for i in range ( 100001 ) ]
def isPrime ( n ) :
    i = 2
    while ( i * i <= n ) :
        if ( n % i == 0 ) :
            return False
        i += 1
    return True
def valid ( a , b ) :
    c = 0
    while ( a ) :
        if ( ( a % 10 ) != ( b % 10 ) ) :
            c += 1
        a = int ( a / 10 )
        b = int ( b / 10 )
    if ( c == 1 ) :
        return True
    else :
        return False
def makePrimes ( N ) :
    global primes
    global lis
    i = 0
    j = 0
    L = pow ( 10 , N - 1 )
    R = pow ( 10 , N ) - 1
    for i in range ( L , R + 1 ) :
        if ( isPrime ( i ) ) :
            primes . append ( i )
    for i in range ( len ( primes ) ) :
        for j in range ( i + 1 , len ( primes ) ) :
            a = primes [ i ]
            b = primes [ j ]
            if ( valid ( a , b ) ) :
                lis [ a ] . append ( b )
                lis [ b ] . append ( a )
def bfs ( src ) :
    global vis
    global dis
    q = [ ]
    q . append ( src )
    vis [ src ] = 1
    dis [ src ] = 0
    while ( len ( q ) != 0 ) :
        curr = q [ 0 ]
        q . pop ( 0 )
        for x in lis [ curr ] :
            if ( vis [ x ] == 0 ) :
                vis [ x ] = 1
                q . append ( x )
                dis [ x ] = dis [ curr ] + 1
N = 4
makePrimes ( N )
A = 1033
B = 8179
bfs ( A )
if ( dis [ B ] == - 1 ) :
    print ( - 1 )
else :
    print ( dis [ B ] )

Index/key variables: B, a, b, curr, i, j, src, x
Accumulator variables: c, primes, q
Iterator variables: i, j, x
Python program:
import math
def findDivisors ( n ) :
    divisors = [ ]
    for i in range ( 1 , int ( math . sqrt ( n ) + 1 ) ) :
        if ( n % i == 0 ) :
            if ( n / i == i ) :
                divisors . append ( i )
            else :
                divisors . append ( i )
                divisors . append ( int ( n / i ) )
    return sorted ( divisors )
def isSuperdNum ( n ) :
    d = findDivisors ( n )
    for i in d :
        x = ( 2 ** i - 2 ) / i
        if int ( x ) != x :
            return False
    return True
if __name__ == " _ _ main _ _ " :
    n = 341
    if isSuperdNum ( n ) == True :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: divisors
Iterator variables: i
Python program:
import math
def BeattySequence ( n ) :
    for i in range ( 1 , n + 1 ) :
        ans = math . floor ( i * math . sqrt ( 2 ) )
        print ( ans , end = ' , ▁ ' )
n = 5
BeattySequence ( n )

Iterator variables: i
Python program:
def getSum ( n ) :
    sum1 = 0 ;
    while ( n != 0 ) :
        sum1 = sum1 + n % 10 ;
        n = n // 10 ;
    return sum1 ;
def isSelfNum ( n ) :
    for m in range ( 1 , n + 1 ) :
        if ( m + getSum ( m ) == n ) :
            return False ;
    return True ;
n = 20 ;
if ( isSelfNum ( n ) ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Iterator variables: m
Python program:
def binomialCoeff ( n , k ) :
    C = [ [ 0 for j in range ( k + 1 ) ] for i in range ( n + 1 ) ]
    i = 0
    j = 0
    for i in range ( n + 1 ) :
        for j in range ( min ( i , k ) + 1 ) :
            if j == 0 or j == i :
                C [ i ] [ j ] = 1
            else :
                C [ i ] [ j ] = ( C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] )
    return C [ n ] [ k ]
if __name__ == ' _ _ main _ _ ' :
    n = 3
    k = n
    n = 2 * n
    print ( binomialCoeff ( n , k ) )

Index/key variables: i, j, k, n
Iterator variables: i, j
Python program:
import math
def getSum ( n ) :
    sum1 = 0 ;
    for i in range ( 1 , int ( math . sqrt ( n ) ) ) :
        if ( n % i == 0 ) :
            if ( n // i == i ) :
                sum1 = sum1 + i ;
            else :
                sum1 = sum1 + i ;
                sum1 = sum1 + ( n // i ) ;
    return sum1 ;
def MultiplyPerfectNumber ( n ) :
    if ( getSum ( n ) % n == 0 ) :
        return True ;
    else :
        return False ;
n = 28 ;
if ( MultiplyPerfectNumber ( n ) ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Iterator variables: i
Python program:
def phi ( n ) :
    result = n
    for p in range ( 2 , n ) :
        if p * p > n :
            break
        if ( n % p == 0 ) :
            while ( n % p == 0 ) :
                n //= p
            result -= result // p
    if ( n > 1 ) :
        result -= result // n
    return result
def isPerfectTotientNum ( n ) :
    temp = n
    sum = 0
    while ( n > 1 ) :
        sum = sum + phi ( n )
        n = phi ( n )
    if ( sum == temp ) :
        return True
    return False
if __name__ == ' _ _ main _ _ ' :
    n = 9
    if ( isPerfectTotientNum ( n ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: n, result
Iterator variables: p