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
< ? php function isBlumInteger ( $ n ) { $ prime = array_fill ( 0 , $ n + 1 , true ) ; for ( $ i = 2 ; $ i * $ i <= $ n ; $ i ++ ) { if ( $ prime [ $ i ] == true ) { for ( $ j = $ i * 2 ; $ j <= $ n ; $ j += $ i ) $ prime [ $ j ] = false ; } } for ( $ i = 2 ; $ i <= $ n ; $ i ++ ) { if ( $ prime [ $ i ] ) { if ( ( $ n % $ i == 0 ) && ( ( $ i - 3 ) % 4 ) == 0 ) { $ q = ( int ) $ n / $ i ; return ( $ q != $ i && $ prime [ $ q ] && ( $ q - 3 ) % 4 == 0 ) ; } } } return false ; } $ n = 249 ; if ( isBlumInteger ( $ n ) ) echo " Yes " ; else echo " No " ; ? >