Blum Integer | Function to cheek if number is Blum Integer ; To store prime numbers from 2 to n ; If prime [ i ] is not changed , then it is a prime ; Update all multiples of p ; To check if the given odd integer is Blum Integer or not ; Checking the factors are of 4 t + 3 form or not ; Give odd integer greater than 20
function isBlumInteger ( n ) { let prime = new Array ( n + 1 ) ; for ( let i = 0 ; i < n ; i ++ ) prime [ i ] = true ; for ( let i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] == true ) { for ( let j = i * 2 ; j <= n ; j += i ) prime [ j ] = false ; } } for ( let i = 2 ; i <= n ; i ++ ) { if ( prime [ i ] ) { if ( ( n % i == 0 ) && ( ( i - 3 ) % 4 ) == 0 ) { let q = parseInt ( n / i , 10 ) ; return ( q != i && prime [ q ] && ( q - 3 ) % 4 == 0 ) ; } } } return false ; } let n = 249 ; if ( isBlumInteger ( n ) == true ) document . write ( " " ) ; else document . write ( " " ) ;