Skip to content

Instantly share code, notes, and snippets.

@savasdersimcelik
Created November 29, 2017 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savasdersimcelik/8e4e6f9eee651dc6af9bd0f8ba1d616a to your computer and use it in GitHub Desktop.
Save savasdersimcelik/8e4e6f9eee651dc6af9bd0f8ba1d616a to your computer and use it in GitHub Desktop.
PHP Zengin Sayılar Algoritması
<?php
/**
* Author : Savaş Dersim ÇELİK
* Version: 1.0.0
* Web: http://webinyo.com
* Mail: savasdersimcelik@gmail.com
* Description : PHP Zengin Sayılar Algoritması
*/
set_time_limit(0);
function bolenleriToplami($param){
$topla = 0;
for ($i=1; $i <$param ; $i++) {
if ($param%$i == 0) {
$topla = $topla + $i;
}
}
return $topla;
}
$sayac = 0;
for ($i=1; $i < 100000; $i++) {
if (bolenleriToplami($i) > $i) {
$sayac++;
}
}
echo $sayac;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment