Click here to Skip to main content
15,885,145 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Given a number N, let P be the set of all the prime divisors of N. Now, let S be another set of all the divisors of N (including 1 and N). Let's define the term Prime Score of a prime divisor x as the number of elements in S which have x as a prime divisor. Output the product of prime scores of all the elements in P modulo 1000003.
For example, let N be 12. Set P will be {2, 3} and set S will be {1, 2, 3, 4, 6, 12}. Now, 2 is a prime divisor of 4 elements in S (2, 4, 6, 12) and 3 is a prime divisor of 3 elements in S (3, 6, 12). So, the prime scores of 2 and 3 would be 4 and 3. respectively. So. the output will be 4*3 mod 1000003 = 12 .

What I have tried:

can anyone give me a solution?
Posted
Updated 8-May-21 14:32pm

As I told you an hour ago:
Quote:
While we are more than willing to help those that are stuck: that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Quote:
Can any one provide solution for this problem in C or java?

Yes, I can, I will not.
As programmer, your job is to create algorithms for such problems. Having us doing the job can help you to give a correct answer for your homework, but it will never help you to learn how to do the job.

To create your own program solution, start by solving the problem by hand.
Your procedure to solve the problem by hand is basically your algorithm, just have to translate to code.

- Learn one or more analyze methods, E.W. Djikstra/N. Wirth Stepwize Refinement/top-Down method is a good start.
Structured Programming.pdf[^]
https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design[^]
https://en.wikipedia.org/wiki/Structured_programming[^]
https://en.wikipedia.org/wiki/Edsger_W._Dijkstra[^]
https://www.cs.utexas.edu/users/EWD/ewd03xx/EWD316.PDF[^]
Program Development by Stepwise Refinement[^]
- Learn Algorithms and Data-Structures.
GitHub - The-Art-of-Computer-Programming-Books: "Everyday life is like programming, I guess. If you love something you can put beauty into it." ? Donald E. Knuth[^]
Skiena The Algorithm Design Manual
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900