diff --git a/C/p041.c b/C/p041.c index 8c2cb6b..99c98e8 100644 --- a/C/p041.c +++ b/C/p041.c @@ -49,6 +49,11 @@ int main(int argc, char **argv) int count_digits(int n) { int i = 0; + + if(n == 0) + { + return 1; + } while(n > 0) { diff --git a/C/p057.c b/C/p057.c index b6da999..f7d6aef 100644 --- a/C/p057.c +++ b/C/p057.c @@ -67,6 +67,11 @@ int count_digits(mpz_t n) int count = 0; mpz_t value; + if(mpz_cmp_ui(n, 0) == 0) + { + return 1; + } + mpz_init_set(value, n); while(mpz_cmp_ui(value, 0)) diff --git a/Python/p047.py b/Python/p047.py index 0940444..fdb0ff3 100644 --- a/Python/p047.py +++ b/Python/p047.py @@ -16,7 +16,7 @@ from timeit import default_timer # Function using a modified sieve of Eratosthenes to count -# the prime factors of each number. +# the distinct prime factors of each number. def count_factors(n): factors = [0] * n i = 2 diff --git a/Python/p060.py b/Python/p060.py index 76f19d4..a1c9f17 100644 --- a/Python/p060.py +++ b/Python/p060.py @@ -82,7 +82,7 @@ def main(): end = default_timer() - print('Project Euler, Problem 59') + print('Project Euler, Problem 60') print('Answer: {}'.format(n)) print('Elapsed time: {:.9f} seconds'.format(end - start))