After finding reciprocal , check if the reciprocal is in A . P . To check for A . P . , first Sort the reciprocal array , then check difference between consecutive elements
sort ( $ rec ) ; $ d = $ rec [ 1 ] - $ rec [ 0 ] ; for ( $ i = 2 ; $ i < $ n ; $ i ++ ) if ( $ rec [ $ i ] - $ rec [ $ i - 1 ] != $ d ) return false ; return true ; }