You are viewing a single comment's thread. Return to all comments →
PHP
<?php function dmss($n) { $dm = 1; while ($n%2 === 0) { $dm = 2; $n /= 2; } for ($i = 3; $i <= sqrt($n); $i += 2) { while ($n%$i === 0) { $dm = $i; $n /= $i; } } if ($n > 2) { $dm = $n; } return $dm; } $handle = fopen ("php://stdin","r"); fscanf($handle,"%d",$t); for($a0 = 0; $a0 < $t; $a0++){ fscanf($handle,"%ld",$n); $kec = dmss($n); echo $kec."\r\n"; } ?>
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #3: Largest prime factor
You are viewing a single comment's thread. Return to all comments →
PHP