Return to Snippet

Revision: 41425
at February 17, 2011 20:59 by iamdezzy


Initial Code
<?php 

$sayi = 1;
$sonsayi = 10000;
	
	for($a=1;$a<$sonsayi;$a++){
		settype($sayi, "string");
		$uzunluk = strlen($sayi);
		if($uzunluk == 1){
			if($sayi == bcpow($sayi[0],$uzunluk)){
				echo $sayi."<br/>";
			}
		}
		if($uzunluk == 2){
			if($sayi == bcpow($sayi[0],$uzunluk-1)+bcpow($sayi[1],$uzunluk)){
				echo $sayi."<br/>";
			}
		}
		if($uzunluk == 3){
			if($sayi == bcpow($sayi[0],$uzunluk-2)+bcpow($sayi[1],$uzunluk-1)+bcpow($sayi[2],$uzunluk)){
				echo $sayi."<br/>";
			}
		}
		
		//Bu if'leri tek bir döngüde nasıl toplarım?

                $sayi++;
	}
?>

Initial URL


Initial Description
Şu iflerin sayısını azaltmaya çalışıyorum. İşlemin uzun sayılar için de tekrarlanmasını istiyorum.

Initial Title
abc = a + b^2  + c^3

Initial Tags


Initial Language
PHP