Created
November 29, 2017 20:16
-
-
Save savasdersimcelik/8e4e6f9eee651dc6af9bd0f8ba1d616a to your computer and use it in GitHub Desktop.
PHP Zengin Sayılar Algoritması
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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