Brahmagupta Fibonacci Identity | PHP code to verify Brahmagupta Fibonacci identity ; represent the product as sum of 2 squares ; check identity criteria ; 1 ^ 2 + 2 ^ 2 ; 3 ^ 2 + 4 ^ 2 ; express product of sum of 2 squares as sum of ( sumof 2 squares )
< ? php function find_sum_of_two_squares ( $ a , $ b ) { $ ab = $ a * $ b ; for ( $ i = 0 ; $ i * $ i <= $ ab ; $ i ++ ) { for ( $ j = $ i ; $ i * $ i + $ j * $ j <= $ ab ; $ j ++ ) { if ( $ i * $ i + $ j * $ j == $ ab ) echo $ i , " ^ 2 ▁ + ▁ " , $ j , " ^ 2 ▁ = ▁ " , $ ab , " STRNEWLINE " ; } } } $ a = 1 * 1 + 2 * 2 ; $ b = 3 * 3 + 4 * 4 ; echo " Representation ▁ of ▁ a ▁ * ▁ b ▁ " . " as ▁ sum ▁ of ▁ 2 ▁ squares : STRNEWLINE " ; find_sum_of_two_squares ( $ a , $ b ) ; ? >