Skip to content

Instantly share code, notes, and snippets.

@Yigaue
Created October 30, 2020 11:52
Show Gist options
  • Save Yigaue/ac1fb2fa2da90dc77e688087bdc29472 to your computer and use it in GitHub Desktop.
Save Yigaue/ac1fb2fa2da90dc77e688087bdc29472 to your computer and use it in GitHub Desktop.
Prosper Permeability algorithm
$permeabilityArray = [9230, 5940, 3080, 2860, 2790, 2370, 1464, 594, 593, 526, 500, 366];
/**
* Each number in the array should take turns to divided it self and every other number in the array,
* and a number can only divide itself or a number that has index greater than it.
* E.g 9230 can divide itself and every other number. 3080 can not divide 5940, and 9230 but can divide
* 2860, 2790, 2370, 1464, 594, 593, 526, 500, and 366.
* Print result different set of arrays.
*/
for ($i = 0; $i < count($permeabilityArray); $i++ ) {
$i_data = [];
foreach ($permeabilityArray as $index => $permeability) {
if ($i <= $index) {
$permeability_ratio = $permeability / $permeabilityArray[$i] . ', ';
array_push($i_data, $permeability_ratio);
}
}
print_r($i_data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment