For an integer n, the prime little omega function,
, is defined as the total number of distinct prime factors of n. So, if
, since
, therefore
.
Given an integer n, write a function that evaluates the following summation:
For example for
:
In this case therefore, the function should return
.
NOTE: This is an easier version of the previous problem, 'Prime Big Omega of Factorial Sequence'. So, for an added challenge, you may enjoy prime factoring each number, as the MATLAB functions 'factor', 'primes' and 'isprime' will be disabled.
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers6
Suggested Problems
-
Count letters occurence in text, specific to words with a given length.
202 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
2210 Solvers
-
1332 Solvers
-
Easy Sequences 16: Volume of Embedded Octahedron
12 Solvers
-
117 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Ramon,
In test #7, I think the last digit of the mean(s) is maybe supposed to be a 3 rather than a 5. I'm also having some problems with test #3, but I haven't investigated that yet.
Hi William,
I can't see where our difference in test#7 is coming from, because even if I use: mean = int64(sum/numel), I'm still getting 7620740342849265. Could it be because of overflow, again? I tried not to exceed 'flintmax' this time, though. Can you publish your solution, please? Thanks.
Regarding test#3, I've checked my solution using the formula: omega(x) = numel(unique(factor(x))), and it seems correct.
Interesting. My solution fails test #7 on my laptop, but passes on the Cody server. The problem with test #3 was my fault!