Skip to content

Instantly share code, notes, and snippets.

@dannyverp
Created March 13, 2020 00:32
Show Gist options
  • Save dannyverp/ca79a4e7c4af0e2431d4250e21b04ace to your computer and use it in GitHub Desktop.
Save dannyverp/ca79a4e7c4af0e2431d4250e21b04ace to your computer and use it in GitHub Desktop.
<?php
sumOfPrimes(int max): int {
$total = 0;
for (int i = 1; i <= max; ++i) {
for (int j = 2; j < i; ++j) {
if (i % j == 0) {
continue;
}
}
total += i;
}
return total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment