dhyuti-n/xlcost-variable-roles huggingface dataset:
Javascript program:
function calcSum ( k , n ) { let value = ( k * n * ( n + 1 ) ) / 2 ; return value ; } function findSum ( a , n , L , R ) { let sum = 0 ; for ( let i = 0 ; i < n ; i ++ ) { if ( L % a [ i ] == 0 && L != 0 ) { sum += calcSum ( a [ i ] , Math . floor ( R / a [ i ] ) ) - calcSum ( a [ i ] , Math . floor ( ( L - 1 ) / a [ i ] ) ) ; } else { sum += calcSum ( a [ i ] , Math . floor ( R / a [ i ] ) ) - calcSum ( a [ i ] , Math . floor ( L / a [ i ] ) ) ; } } return sum ; } let arr = [ 2 , 7 , 3 , 8 ] ; let N = arr . length ; let L = 7 ; let R = 20 ; document . write ( findSum ( arr , N , L , R ) ) ;

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Javascript program:
let maxN = 1000000 ; let arr = Array . from ( { length : 1000001 } , ( _ , i ) => 0 ) ; let prefix = Array . from ( { length : 1000001 } , ( _ , i ) => 0 ) ; function findPrimes ( ) { for ( let i = 1 ; i <= maxN ; i ++ ) arr [ i ] = 1 ; arr [ 0 ] = 0 ; arr [ 1 ] = 0 ; for ( let i = 2 ; i * i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { for ( let j = i * i ; j <= maxN ; j += i ) { arr [ j ] = 0 ; } } } let sum = 0 ; prefix [ 0 ] = 0 ; for ( let i = 1 ; i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { let temp = i ; sum = 0 ; while ( temp > 0 ) { let x = temp % 10 ; sum += x ; temp = Math . floor ( temp / 10 ) ; if ( arr [ sum ] == 1 ) { prefix [ i ] = 1 ; } else { prefix [ i ] = 0 ; } } } } for ( let i = 1 ; i <= maxN ; i ++ ) { prefix [ i ] += prefix [ i - 1 ] ; } } function countNumbersInRange ( l , r ) { findPrimes ( ) ; let result = prefix [ r ] - prefix [ l - 1 ] ; document . write ( result + " " ) ; } let l , r ; l = 5 ; r = 20 ; countNumbersInRange ( l , r ) ;

Index/key variables: i, j, r, sum
Accumulator variables: i, j, sum
Iterator variables: i, j
Javascript program:
function isSubsetSum ( set , n , sum ) { var subset = Array . from ( Array ( n + 1 ) , ( ) => Array ( sum + 1 ) ) ; for ( var i = 0 ; i <= n ; i ++ ) subset [ i ] [ 0 ] = true ; for ( var i = 1 ; i <= sum ; i ++ ) subset [ 0 ] [ i ] = false ; for ( var i = 1 ; i <= n ; i ++ ) { for ( var j = 1 ; j <= sum ; j ++ ) { if ( j < set [ i - 1 ] ) subset [ i ] [ j ] = subset [ i - 1 ] [ j ] ; if ( j >= set [ i - 1 ] ) subset [ i ] [ j ] = subset [ i - 1 ] [ j ] || subset [ i - 1 ] [ j - set [ i - 1 ] ] ; } } return subset [ n ] [ sum ] ; } function storeDivisors ( n , div ) { for ( var i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) div . push ( i ) ; else { div . push ( i ) ; div . push ( n / i ) ; } } } } function isPractical ( N ) { div = [ ] ; storeDivisors ( N , div ) ; for ( var i = 1 ; i < N ; i ++ ) { if ( ! isSubsetSum ( div , div . length , i ) ) return false ; } return true ; } var N = 18 ; isPractical ( N ) ? document . write ( " " ) : document . write ( " " ) ;

Index/key variables: i, j, n, sum
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function isDivBySubsetSums ( arr , num ) { var n = arr . length ; var total = 1 << n ; for ( var i = 0 ; i < total ; i ++ ) { var sum = 0 ; for ( var j = 0 ; j < n ; j ++ ) if ( i & ( 1 << j ) ) sum += arr [ j ] ; if ( sum != 0 && num % sum != 0 ) return false ; } return true ; } function isSuperNivenNum ( n ) { var temp = n ; var digits = [ ] ; while ( n != 0 ) { var digit = n % 10 ; digits . push ( digit ) ; n = parseInt ( n / 10 ) ; } return isDivBySubsetSums ( digits , temp ) ; } var n = 500 ; if ( isSuperNivenNum ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: j
Accumulator variables: i, j, sum
Iterator variables: i, j
Javascript program:
function divCount ( n ) { let hash = Array ( n + 1 ) . fill ( true ) ; for ( let p = 2 ; p * p < n ; p ++ ) if ( hash [ p ] == true ) for ( i = p * 2 ; i < n ; i += p ) hash [ i ] = false ; let total = 1 ; for ( p = 2 ; p <= n ; p ++ ) { if ( hash [ p ] ) { let count = 0 ; if ( n % p == 0 ) { while ( n % p == 0 ) { n = n / p ; count ++ ; } total = total * ( count + 1 ) ; } } } return total ; } function isHighlyCompositeNumber ( N ) { let NdivCount = divCount ( N ) ; for ( let i = 1 ; i < N ; i ++ ) { let idivCount = divCount ( i ) ; if ( idivCount >= NdivCount ) return false ; } return true ; } let N = 12 ; if ( isHighlyCompositeNumber ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i, p
Accumulator variables: count, i, p
Iterator variables: i, p
Javascript program:
function isSaintExuperyNum ( n ) { for ( i = 1 ; i <= n / 3 ; i ++ ) { for ( j = i + 1 ; j <= n / 2 ; j ++ ) { let k = n / i / j ; if ( i * i + j * j == k * k ) { if ( i * j * k == n ) return true ; } } } return false ; } let N = 60 ; if ( isSaintExuperyNum ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function isComposite ( n ) { if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( var i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } function concatenatePrimeFactors ( n ) { var concatenate ; if ( n % 2 == 0 ) { concatenate += " " ; while ( n % 2 == 0 ) n = parseInt ( n / 2 ) ; } for ( var i = 3 ; i <= Math . sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { concatenate += i ; while ( n % i == 0 ) n = parseInt ( n / i ) ; } } if ( n > 2 ) concatenate += n ; return concatenate ; } function isEnlightened ( N ) { if ( ! isComposite ( N ) ) return false ; var num = ( N . toString ( ) ) ; var prefixConc = concatenatePrimeFactors ( N ) ; return ( prefixConc ) ; } var n = 250 ; if ( isEnlightened ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: concatenate
Iterator variables: i
Javascript program:
function isIdoneal ( n ) { for ( var a = 1 ; a <= n ; a ++ ) { for ( var b = a + 1 ; b <= n ; b ++ ) { for ( var c = b + 1 ; c <= n ; c ++ ) { if ( a * b + b * c + c * a == n ) return false ; } } } return true ; } var N = 10 ; if ( isIdoneal ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: a, b, c
Iterator variables: a, b, c
Javascript program:
function checkDivisibility ( n , digit ) { return ( digit != 0 && n % digit == 0 ) ; } function isAllDigitsDivide ( n ) { let temp = n ; while ( temp > 0 ) { let digit = temp % 10 ; if ( ! ( checkDivisibility ( n , digit ) ) ) return false ; temp = parseInt ( temp / 10 ) ; } return true ; } function isAllDigitsDistinct ( n ) { let arr = Array ( 10 ) . fill ( 0 ) ; while ( n > 0 ) { let digit = n % 10 ; if ( arr [ digit ] ) return false ; arr [ digit ] = true ; n = parseInt ( n / 10 ) ; } return true ; } function isLynchBell ( n ) { return isAllDigitsDivide ( n ) && isAllDigitsDistinct ( n ) ; } let N = 12 ; if ( isLynchBell ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: digit
Javascript program:
function isRepunitNum ( n , b ) { let length = 0 ; let countOne = 0 ; while ( n != 0 ) { let r = n % b ; length ++ ; if ( r == 1 ) countOne ++ ; n = parseInt ( n / b ) ; } return countOne >= 3 && countOne == length ; } let n = 31 ; let base = 2 ; if ( isRepunitNum ( n , base ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: countOne
Javascript program:
var MAX = 1000050 ; var spf = Array ( MAX + 1 ) ; function calculate_SPF ( ) { for ( var i = 0 ; i <= MAX ; i ++ ) spf [ i ] = i ; for ( var i = 4 ; i <= MAX ; i += 2 ) spf [ i ] = 2 ; for ( var i = 3 ; i * i <= MAX ; i ++ ) { if ( spf [ i ] == i ) { for ( var j = i * i ; j <= MAX ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } var tfactor = Array ( MAX + 1 ) ; var pre = Array ( MAX + 1 ) ; function CountTotalfactors ( ) { tfactor [ 1 ] = pre [ 1 ] = 1 ; for ( var i = 2 ; i <= MAX ; i ++ ) { var mspf = spf [ i ] ; var prim = mspf ; var temp = i ; var cnt = 0 ; while ( temp % mspf == 0 ) { temp = parseInt ( temp / mspf ) ; cnt += 1 ; prim = prim * mspf ; } tfactor [ i ] = ( cnt + 1 ) * tfactor [ temp ] ; pre [ i ] = pre [ i - 1 ] + tfactor [ i ] ; } } function BinarySearch ( X ) { var start = 1 ; var end = MAX - 1 ; while ( start < end ) { var mid = parseInt ( ( start + end ) / 2 ) ; if ( pre [ mid ] == X ) return mid ; else if ( pre [ mid ] < X ) start = mid + 1 ; else end = mid ; } return start ; } function findSumOfCount ( X ) { calculate_SPF ( ) ; CountTotalfactors ( ) ; document . write ( BinarySearch ( X ) + " " ) ; } var X = 10 ; findSumOfCount ( X ) ;

Index/key variables: i, j, mid, temp
Accumulator variables: cnt, i, j
Iterator variables: i, j
Javascript program:
var prime = [ ] ; function buildSieve ( sum ) { prime = Array ( sum + 1 ) . fill ( true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( var p = 2 ; p * p < ( sum + 1 ) ; p ++ ) { if ( prime [ p ] == true ) { for ( var i = p * 2 ; i < ( sum + 1 ) ; i += p ) prime [ i ] = false ; } } } function getSum ( a ) { var s = 0 ; for ( var i = 0 ; i < 4 ; i ++ ) for ( var j = 0 ; j < 5 ; j ++ ) s += a [ i ] [ j ] ; return s ; } function checkIndex ( n , m , a ) { for ( var i = 0 ; i < n ; i ++ ) for ( var j = 0 ; j < m ; j ++ ) { if ( prime [ i + j ] && ! prime [ a [ i ] [ j ] ] ) { return false ; } } return true ; } var n = 4 , m = 5 ; var a = [ [ 1 , 2 , 3 , 2 , 2 ] , [ 2 , 2 , 7 , 7 , 7 ] , [ 7 , 7 , 21 , 7 , 10 ] , [ 2 , 2 , 3 , 6 , 7 ] ] ; var sum = getSum ( a ) ; buildSieve ( sum ) ; if ( prime [ sum ] && checkIndex ( n , m , a ) ) { document . write ( " " ) ; } else document . write ( " " ) ;

Index/key variables: i, j, p, sum
Accumulator variables: i, j, p, s
Iterator variables: i, j, p
Javascript program:
function findDivisors ( n ) { let divisors = [ ] for ( let i = 1 ; i < Math . floor ( Math . sqrt ( n ) + 1 ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) { divisors . push ( i ) } else { divisors . push ( i ) divisors . push ( Math . floor ( n / i ) ) } } } return divisors . sort ( ( a , b ) => a - b ) } function isSuperdNum ( n ) { let d = findDivisors ( n ) for ( let i in d ) { let x = ( 2 ** i - 2 ) / i if ( Math . floor ( x ) != x ) { return false } } return true } let n = 341 if ( isSuperdNum ( n ) == true ) { document . write ( " " ) } else { document . write ( " " ) }

Accumulator variables: i
Iterator variables: i
Javascript program:
function BeattySequence ( n ) { for ( let i = 1 ; i <= n ; i ++ ) { let ans = parseInt ( Math . floor ( i * Math . sqrt ( 2 ) ) ) ; document . write ( ans + " " ) ; } } let n = 5 ; BeattySequence ( n ) ;

Accumulator variables: i
Iterator variables: i
Javascript program:
function getSum ( n ) { let sum = 0 ; for ( let i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; else { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } function checkAbundant ( n ) { return ( getSum ( n ) - n > n ) ; } function isDeficient ( n ) { return ( getSum ( n ) < ( 2 * n ) ) ; } function checkPrimitiveAbundant ( num ) { if ( ! checkAbundant ( num ) ) { return false ; } for ( let i = 2 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 && i != num ) { if ( i * i == num ) { if ( ! isDeficient ( i ) ) { return false ; } } else if ( ! isDeficient ( i ) || ! isDeficient ( num / i ) ) { return false ; } } } return true ; } let n = 20 ; if ( checkPrimitiveAbundant ( n ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Accumulator variables: i
Iterator variables: i
Javascript program:
function divSum ( num ) { let result = 0 ; for ( let i = 1 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return ( result - 1 - num ) ; } function getSum ( n ) { let sum = 0 ; while ( n != 0 ) { let r = n % 10 ; sum = sum + r * r ; n = parseInt ( n / 10 ) ; } return sum ; } function isCanada ( n ) { return divSum ( n ) == getSum ( n ) ; } let n = 125 ; if ( isCanada ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i, result
Iterator variables: i
Javascript program:
function getSum ( n ) { let sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = parseInt ( n / 10 ) ; } return sum ; } function isSelfNum ( n ) { for ( let m = 1 ; m <= n ; m ++ ) { if ( m + getSum ( m ) == n ) return false ; } return true ; } let n = 20 ; if ( isSelfNum ( n ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Accumulator variables: m
Iterator variables: m
Javascript program:
function binomialCoeff ( n , k ) { var C = Array . from ( Array ( n + 1 ) , ( ) => Array ( k + 1 ) ) ; var i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } return C [ n ] [ k ] ; } var n = 3 ; var k = n ; n = 2 * n ; document . write ( binomialCoeff ( n , k ) ) ;

Index/key variables: i, j, k, n
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function getSum ( n ) { let sum = 0 ; for ( i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; else { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } function MultiplyPerfectNumber ( n ) { if ( getSum ( n ) % n == 0 ) return true ; else return false ; } let n = 28 ; if ( MultiplyPerfectNumber ( n ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Accumulator variables: i
Iterator variables: i
Javascript program:
function phi ( n ) { let result = n ; for ( let p = 2 ; p * p <= n ; ++ p ) { if ( n % p == 0 ) { while ( n % p == 0 ) { n = parseInt ( n / p ) ; } result -= parseInt ( result / p ) ; } } if ( n > 1 ) result -= parseInt ( result / n ) ; return result ; } function isPerfectTotientNum ( n ) { let temp = n ; let sum = 0 ; while ( n > 1 ) { sum = sum + phi ( n ) ; n = phi ( n ) ; } if ( sum == temp ) return true ; return false ; } let n = 9 ; if ( isPerfectTotientNum ( n ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Accumulator variables: result
Iterator variables: p
Javascript program:
function isPower ( a ) { if ( a == 1 ) return true ; for ( let i = 2 ; i * i <= a ; i ++ ) { let val = Math . log ( a ) / Math . log ( i ) ; if ( ( val - parseInt ( val ) < 0.00000001 ) ) return true ; } return false ; } function isCunningham ( n ) { return isPower ( n - 1 ) || isPower ( n + 1 ) ; } let n = 126 ; if ( isCunningham ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i
Iterator variables: i
Javascript program:
function SubArrayProdct ( arr , n ) { let result = 1 ; for ( let i = 0 ; i < n ; i ++ ) result *= Math . pow ( arr [ i ] , ( i + 1 ) * ( n - i ) ) ; return result ; } let arr = [ 2 , 4 ] ; let N = arr . length ; document . write ( SubArrayProdct ( arr , N ) ) ;

Index/key variables: i
Accumulator variables: i, result
Iterator variables: i
Javascript program:
function nCr ( n , r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } function fact ( n ) { let res = 1 ; for ( let i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } function countWays ( m , n , x , y ) { return nCr ( m + n , m ) - nCr ( x + y , x ) * nCr ( m + n - x - y , m - x ) ; } let m = 5 ; let n = 4 ; let x = 3 ; let y = 2 ; document . write ( countWays ( m , n , x , y ) ) ;

Accumulator variables: i
Iterator variables: i
Javascript program:
function solve ( N ) { let ans = 0 ; while ( N != 0 ) { ans += N ; N = parseInt ( N / 2 , 10 ) ; } document . write ( ans ) ; } let N = 5 ; solve ( N ) ;

Accumulator variables: ans
Javascript program:
function oddSum ( A , N , K ) { let Odd = new Set ( ) ; let Even = new Set ( ) ; for ( let i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 ) { Even . add ( A [ i ] ) ; } else { Odd . add ( A [ i ] ) ; } } if ( Odd . size >= K ) return true ; let flag = false ; for ( let i = 1 ; i < K ; i += 2 ) { let needed = K - i ; if ( needed <= Even . size ) { return true ; } } return flag ; } let K = 5 ; let A = [ 12 , 1 , 7 , 7 , 26 , 18 ] ; let N = 3 ; if ( oddSum ( A , N , K ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Javascript program:
function countEle ( a , n ) { let len = 0 ; let hmap = new Map ( ) ; for ( let i = 0 ; i < n ; i ++ ) { len = Math . max ( len , a [ i ] ) ; if ( hmap . has ( a [ i ] ) ) { hmap . set ( a [ i ] , hmap . get ( a [ i ] ) + 1 ) ; } else { hmap . set ( a [ i ] , 1 ) ; } } let v = Array . from ( { length : len + 1 } , ( _ , i ) => 0 ) ; for ( let i = 0 ; i <= len ; i ++ ) { v [ i ] = true ; } for ( let i = 0 ; i < n ; i ++ ) { if ( v [ a [ i ] ] == false ) continue ; for ( let j = 2 * a [ i ] ; j <= len ; j += a [ i ] ) { v [ j ] = false ; } } let count = 0 ; for ( let i = 1 ; i <= len ; i ++ ) { if ( v [ i ] == true && hmap . has ( i ) && hmap . get ( i ) == 1 && hmap . get ( i ) == 1 ) { count += 1 ; } } return count ; } let arr = [ 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 ] ; let n = arr . length ; document . write ( countEle ( arr , n ) ) ;

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Javascript program:
function smallestNumber ( N ) { let L = Math . pow ( 10 , N ) - 1 ; let S = Math . pow ( 10 , N - 1 ) ; for ( let i = S ; i <= L ; i ++ ) { if ( i % N == 0 ) { document . write ( i ) ; return ; } } } let N = 2 ; smallestNumber ( N ) ;

Accumulator variables: i
Iterator variables: i
Javascript program:
function maxPrimefactorNum ( N ) { let arr = Array ( N + 1 ) . fill ( 1 ) ; for ( let i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] == 1 ) { for ( let j = i ; j <= N ; j += i ) { arr [ j ] *= i ; } } } let maxValue = 1 ; for ( let i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] > maxValue ) { maxValue = i ; } } return maxValue ; } let N = 20 ; document . write ( maxPrimefactorNum ( N ) ) ;

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function spf_array ( spf ) { spf [ 1 ] = 1 ; for ( var i = 2 ; i < 1000 ; i ++ ) spf [ i ] = i ; for ( var i = 4 ; i < 1000 ; i += 2 ) spf [ i ] = 2 ; for ( var i = 3 ; i * i < 1000 ; i ++ ) { if ( spf [ i ] == i ) { for ( var j = i * i ; j < 1000 ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } function minimum_operation ( b , d , spf ) { var m = new Map ( ) ; var i = 0 ; var c = 0 ; for ( i = 0 ; i < d ; i ++ ) { var x = b [ i ] ; while ( x != 1 ) { x = parseInt ( x / spf [ x ] ) ; if ( ! m . has ( spf [ x ] ) ) { m . set ( spf [ x ] , 1 ) ; } } } m . delete ( 1 ) ; m . forEach ( ( value , key ) => { var e = 0 , o = 0 ; var j = key ; for ( i = 0 ; i < d ; i ++ ) { if ( b [ i ] % j == 0 ) { var h = 0 ; var g = b [ i ] ; while ( g != 0 ) { if ( g % j != 0 ) { break ; } g = parseInt ( g / j ) ; h = h + 1 ; } if ( h % 2 == 0 ) { e = e + 1 ; } else { o = o + 1 ; } } else { e = e + 1 ; } } c = c + Math . min ( o , e ) ; } ) ; return c ; } var spf = Array ( 1001 ) var b = [ 1 , 4 , 6 ] ; var d = b . length ; spf_array ( spf ) ; document . write ( minimum_operation ( b , d , spf ) ) ;

Index/key variables: i, j, x
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function isPrime ( n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( let i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } function getSum ( n ) { let sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } function isAdditivePrime ( n ) { if ( ! isPrime ( n ) ) return false ; return isPrime ( getSum ( n ) ) ; } let n = 23 ; if ( isAdditivePrime ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Iterator variables: i
Javascript program:
function isStraighLineNum ( N ) { if ( N <= 99 ) return false ; let s = N . toString ( ) ; let d = s [ 1 ] - s [ 0 ] ; for ( let i = 2 ; i < s . length ; i ++ ) if ( s [ i ] - s [ i - 1 ] != d ) return false ; return true ; } let n = 135 ; if ( isStraighLineNum ( n ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function isEvenOddForm ( s ) { let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 && s [ i ] % 2 != 0 ) return false ; if ( i % 2 == 1 && s [ i ] % 2 != 1 ) return false ; } return true ; } function isOddEvenForm ( s ) { let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 && s [ i ] % 2 != 1 ) return false ; if ( i % 2 == 1 && s [ i ] % 2 != 0 ) return false ; } return true ; } function isAlternating ( n ) { let str = n . toString ( ) ; return ( isEvenOddForm ( str ) || isOddEvenForm ( str ) ) ; } let N = 129 ; if ( isAlternating ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function isPrime ( n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( let i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } const TEN = 10 ; function updateFreq ( n , freq ) { while ( n > 0 ) { let digit = n % TEN ; freq [ digit ] ++ ; n = parseInt ( n / TEN ) ; } } function areAnagrams ( a , b ) { let freqA = Array ( TEN ) . fill ( 0 ) ; let freqB = Array ( TEN ) . fill ( 0 ) ; updateFreq ( a , freqA ) ; updateFreq ( b , freqB ) ; for ( i = 0 ; i < TEN ; i ++ ) { if ( freqA [ i ] != freqB [ i ] ) return false ; } return true ; } function OrmistonPrime ( n1 , n2 ) { return ( isPrime ( n1 ) && isPrime ( n2 ) && areAnagrams ( n1 , n2 ) ) ; } let n1 = 1913 , n2 = 1931 ; if ( OrmistonPrime ( n1 , n2 ) ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ;

Index/key variables: digit, i
Accumulator variables: i
Iterator variables: i
Javascript program:
function divSum ( num ) { let result = 0 ; for ( let i = 2 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return ( result + 1 ) ; } function isUntouchable ( n ) { for ( let i = 1 ; i <= 2 * n ; i ++ ) { if ( divSum ( i ) == n ) return false ; } return true ; } let n = 52 ; if ( isUntouchable ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i, result
Iterator variables: i
Javascript program:
function iszygodromeNum ( N ) { let s = N . toString ( ) ; s = ' ' + s + ' ' ; for ( i = 1 ; i < s . length - 1 ; i ++ ) { if ( s [ i ] != s [ i - 1 ] && s [ i ] != s [ i + 1 ] ) { return false ; } } return true ; } let n = 1122 ; if ( iszygodromeNum ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function isLoeschian ( n ) { for ( let x = 1 ; x <= Math . sqrt ( n ) ; x ++ ) { for ( let y = 1 ; y <= Math . sqrt ( n ) ; y ++ ) { if ( x * x + x * y + y * y == n ) return true ; } } return false ; } let n = 19 ; if ( isLoeschian ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: x, y
Iterator variables: x, y
Javascript program:
function divSum ( n ) { let result = 0 ; for ( let i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } function check ( num ) { let sigmaN = divSum ( num ) ; for ( let i = 2 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) { if ( sigmaN - 2 * i == 2 * num ) return true ; } else { if ( sigmaN - 2 * i == 2 * num ) return true ; if ( sigmaN - 2 * ( num / i ) == 2 * num ) return true ; } } } if ( sigmaN - 2 * 1 == 2 * num ) return true ; return false ; } function isAdmirableNum ( N ) { return check ( N ) ; } let n = 12 ; if ( isAdmirableNum ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i, result
Iterator variables: i
Javascript program:
function printSeries ( N ) { let ith_term = 0 ; for ( let i = 1 ; i <= N ; i ++ ) { ith_term = ( 13 * i * ( i - 1 ) ) / 2 + 2 ; document . write ( ith_term + " " ) ; } } let N = 7 ; printSeries ( N ) ;

Accumulator variables: i
Iterator variables: i