5 kyu
When The Sum of The Divisors Is A Multiple Of The Prime Factors Sum
228 of 450raulbc777
Description:
The numbers 12, 63 and 119 have something in common related with their divisors and their prime factors, let's see it.
Numbers PrimeFactorsSum(pfs) DivisorsSum(ds) Is ds divisible by pfs
12 2 + 2 + 3 = 7 1 + 2 + 3 + 4 + 6 + 12 = 28 28 / 7 = 4, Yes
63 3 + 3 + 7 = 13 1 + 3 + 7 + 9 + 21 + 63 = 104 104 / 13 = 8, Yes
119 7 + 17 = 24 1 + 7 + 17 + 119 = 144 144 / 24 = 6, Yes
There is an obvius property you can see: the sum of the divisors of a number is divisible by the sum of its prime factors.
We need the function ds_multof_pfs()
that receives two arguments: nMin
and nMax
, as a lower and upper limit (inclusives), respectively, and outputs a sorted list with the numbers that fulfill the property described above.
We represent the features of the described function:
ds_multof_pfs(nMin, nMax) -----> [n1, n2, ....., nl] # nMin ≤ n1 < n2 < ..< nl ≤ nMax
Let's see some cases:
ds_multof_pfs(10, 100) == [12, 15, 35, 42, 60, 63, 66, 68, 84, 90, 95]
ds_multof_pfs(20, 120) == [35, 42, 60, 63, 66, 68, 84, 90, 95, 110, 114, 119]
Enjoy it!!
Mathematics
Algorithms
Similar Kata:
Stats:
Created | Oct 24, 2015 |
Published | Oct 24, 2015 |
Warriors Trained | 1608 |
Total Skips | 102 |
Total Code Submissions | 2140 |
Total Times Completed | 450 |
Python Completions | 228 |
JavaScript Completions | 153 |
Ruby Completions | 28 |
C# Completions | 38 |
Go Completions | 14 |
Rust Completions | 25 |
D Completions | 4 |
Total Stars | 62 |
% of votes with a positive feedback rating | 89% of 98 |
Total "Very Satisfied" Votes | 81 |
Total "Somewhat Satisfied" Votes | 13 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 8 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |