print-hello-world

A potpourri of programming languages

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
<?php
// PHP

function gcd(int $a, int $b) {
    if ($b > 0) return gcd($b, $a % $b);
    else return $a;
}

echo "test\n";

const N = 1000;
$A = array();
for ($i = 0; $i < N; $i++) {
    $A[$i] = $i;
}

$ans = 0;
foreach ($A as $i) {
    foreach ($A as $j) {
        $ans += gcd($i, $j);
    }
}
echo $ans;