Check if a prime number can be expressed as sum of two Prime Numbers | Function to check whether a number is prime or not ; Function to check if a prime number can be expressed as sum of two Prime Numbers ; If the number is prime , and number - 2 is also prime ; Driver code
function isPrime ( n ) { if ( n <= 1 ) return false ; for ( var i = 2 ; i <= parseInt ( Math . sqrt ( n ) ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } function isPossible ( N ) { if ( isPrime ( N ) && isPrime ( N - 2 ) ) return true ; else return false ; } var n = 13 ; if ( isPossible ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;