fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $alowgearf = 14.37;
  6. $ahigear = 3.293;
  7. $noOfGear = 5;
  8. $loopLimit = $noOfGear - 2;
  9.  
  10. $gears = array(0 => "$alowgearf", 4 => "$ahigear");
  11.  
  12. $nlnh = $alowgearf/$ahigear;
  13. $cgp = pow($nlnh, 1/($noOfGear - 1));
  14.  
  15.  
  16.  
  17. for ( $n = 1; $n <= $loopLimit ; $n++ ) {
  18. $m = $n - 1;
  19. $gear = $gears[$m]/$cgp;
  20. $gears[$n] = $gear;
  21. }
  22.  
  23.  
  24.  
  25.  
  26.  
  27. print_r($gears);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 14.37
    [4] => 3.293
    [1] => 9.9423834528791
    [2] => 6.8789832097484
    [3] => 4.7594633846371
)