Check whether a number can be represented by sum of two squares | function to check if there exist two numbers sum of whose squares is n . ; Driver Code
< ? php function sumSquare ( int $ n ) { for ( $ i = 1 ; $ i * $ i <= $ n ; $ i ++ ) for ( $ j = 1 ; $ j * $ j <= $ n ; $ j ++ ) if ( $ i * $ i + $ j * $ j == $ n ) { echo $ i , " ^ 2 ▁ + ▁ " , $ j , " ^ 2" ; return true ; } return false ; } $ n = 25 ; if ( sumSquare ( $ n ) ) echo " ▁ STRNEWLINE " , " Yes " ; else echo " No " ; ? >