Probability for three randomly chosen numbers to be in AP | function to calculate probability ; Driver code
< ? php function procal ( $ n ) { return ( 3.0 * $ n ) / ( 4.0 * ( $ n * $ n ) - 1 ) ; } $ a = array ( 1 , 2 , 3 , 4 , 5 ) ; $ n = sizeof ( $ a ) ; echo procal ( $ n ) ; ? >