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

Stats:

CreatedOct 24, 2015
PublishedOct 24, 2015
Warriors Trained1608
Total Skips102
Total Code Submissions2140
Total Times Completed450
Python Completions228
JavaScript Completions153
Ruby Completions28
C# Completions38
Go Completions14
Rust Completions25
D Completions4
Total Stars62
% of votes with a positive feedback rating89% of 98
Total "Very Satisfied" Votes81
Total "Somewhat Satisfied" Votes13
Total "Not Satisfied" Votes4
Total Rank Assessments8
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • raulbc777 Avatar
  • anter69 Avatar
  • smile67 Avatar
  • Blind4Basics Avatar
  • Firefly2002 Avatar
  • bidouille Avatar
  • hobovsky Avatar
  • akar-0 Avatar
  • dfhwze Avatar
Ad