Skip to content

Commit

Permalink
Correct p23
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 22, 2024
1 parent d6225f3 commit 081d5f4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions javascript/src/p0023.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@
**/
exports.p0023 = function() {
const abundantSums = new Set([24]);
const abundants = [...iters.abundants(28112)];
for (const x of abundants) {
for (const y of abundants) {
abundantSums.add(x + y);
}
for (const [x, y] of iters.combinationsWithReplacement(iters.abundants(28112), 2)) {
abundantSums.add(x + y);
}
let sum = 0;
for (let x = 1; x < 28124; x++) {
if (abundantSums.has(x)) {
if (!abundantSums.has(x)) {
sum += x;
}
}
Expand Down

0 comments on commit 081d5f4

Please sign in to comment.