diff options
| author | 冯昶 <seaker@qq.com> | 2021-11-01 15:35:34 +0800 |
|---|---|---|
| committer | 冯昶 <seaker@qq.com> | 2021-11-01 15:35:34 +0800 |
| commit | 47c592ce79003fa05dc7f2d5d1f22c5ef2ff1b4e (patch) | |
| tree | e17cb3ca27261d8e37f610cd90a8081a2110e6ff /challenge-133/paulo-custodio/python/ch-2.py | |
| parent | 6feeaa5f2efa5e3a0e27aa9610f0f686ea7c34a8 (diff) | |
| parent | aa267843f108e0b591cbbf2f13428354c74b2f70 (diff) | |
| download | perlweeklychallenge-club-47c592ce79003fa05dc7f2d5d1f22c5ef2ff1b4e.tar.gz perlweeklychallenge-club-47c592ce79003fa05dc7f2d5d1f22c5ef2ff1b4e.tar.bz2 perlweeklychallenge-club-47c592ce79003fa05dc7f2d5d1f22c5ef2ff1b4e.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-133/paulo-custodio/python/ch-2.py')
| -rw-r--r-- | challenge-133/paulo-custodio/python/ch-2.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/challenge-133/paulo-custodio/python/ch-2.py b/challenge-133/paulo-custodio/python/ch-2.py index 1cab0e4e43..adfc274f4a 100644 --- a/challenge-133/paulo-custodio/python/ch-2.py +++ b/challenge-133/paulo-custodio/python/ch-2.py @@ -3,13 +3,13 @@ # TASK #2 > Smith Numbers # Submitted by: Mohammad S Anwar # Write a script to generate first 10 Smith Numbers in base 10. -# +# # According to Wikipedia: -# +# # In number theory, a Smith number is a composite number for which, in a given -# number base, the sum of its digits is equal to the sum of the digits in its +# number base, the sum of its digits is equal to the sum of the digits in its # prime factorization in the given number base. -# +# def is_prime(n): if n <= 1: @@ -35,10 +35,10 @@ def get_prime_factors(n): n //= i else: i += 1 - + if n>1: prime_factors.append(n) - + return prime_factors def is_smith(n): @@ -50,7 +50,7 @@ def is_smith(n): fact_digits = [int(x) for x in factors] sum2 = sum(fact_digits) return sum1==sum2 - + n=1 count=0 while count<10: |
