From 3b3579d592896eef8ce7649008ac4cbcc17581fd Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 23 Jul 2024 00:20:03 -0500 Subject: [PATCH] Correct several minor issues --- c/p0012.c | 2 +- docs/cplusplus/p0034.rst | 1 - python/p0012.py | 2 +- rust/src/p0012.rs | 2 +- rust/src/p0015.rs | 2 +- rust/src/p0076.rs | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/c/p0012.c b/c/p0012.c index 80fee87d..cd248335 100644 --- a/c/p0012.c +++ b/c/p0012.c @@ -59,7 +59,7 @@ unsigned long long p0012() { while (true) { current = next(ti); // printf("%llu\n", current); - if (proper_divisor_count(current) > 499) + if (proper_divisor_count(current) > 500) return current; } } diff --git a/docs/cplusplus/p0034.rst b/docs/cplusplus/p0034.rst index 9369880d..324b5bca 100644 --- a/docs/cplusplus/p0034.rst +++ b/docs/cplusplus/p0034.rst @@ -6,7 +6,6 @@ View source code `here on GitHub! `__ - `math.h <./math.html>`__ Solution diff --git a/python/p0012.py b/python/p0012.py index 41cd893f..ac683daf 100644 --- a/python/p0012.py +++ b/python/p0012.py @@ -38,7 +38,7 @@ def main() -> int: num = 0 for x in count(1): num += x - if sum(1 for _ in proper_divisors(num)) > 499: + if sum(1 for _ in proper_divisors(num)) > 500: return num return -1 diff --git a/rust/src/p0012.rs b/rust/src/p0012.rs index 2d094bb2..461b61a8 100644 --- a/rust/src/p0012.rs +++ b/rust/src/p0012.rs @@ -33,7 +33,7 @@ pub fn p0012() -> i128 { let mut num: u64 = 0; for x in 1.. { num += x; - if primes::proper_divisors(num).len() > 499 { + if primes::proper_divisors(num).len() > 500 { return num.into(); } } diff --git a/rust/src/p0015.rs b/rust/src/p0015.rs index b5802526..56907b09 100644 --- a/rust/src/p0015.rs +++ b/rust/src/p0015.rs @@ -13,5 +13,5 @@ Find the sum of all the primes below two million. use crate::math; pub fn p0015() -> i128 { - return math::n_choose_r(40, 20).into(); + return math::n_choose_r(40, 20); } diff --git a/rust/src/p0076.rs b/rust/src/p0076.rs index a6affa9e..9e8ff5d5 100644 --- a/rust/src/p0076.rs +++ b/rust/src/p0076.rs @@ -35,7 +35,7 @@ pub fn p0076() -> i128 { idx += 1; counts[idx] += idx as u64; sum = counts.iter().sum(); - if !(sum > 100) { + if sum <= 100 { break; } }