I really need help with this and a sarcastic comment is not what I consider help, so if you can please give me a hand with this. Any help is appreciated, thanks in advance.
I was assigned a homework where I have to use recursion to find prime numbers of any integer entered by the user. Does anyone have any ideas on what I should do. typing out the code itself won't be too much of a problem, but I can't find a formula that will do the math.
>Use a loop starting at one and divide by that number as much as possible then move on to next
1 is not a prime number
> Make sure your program implements a recursive algorithm.
I might be wrong, but I'm sure this does not mean that the entire process of getting the prime has to be recursive, it can also recursively call a function lol.
I'm not sure if I'm right, but if you do implement an entirely recursive algorithm to solve this, you will be going deep. Like level 7 inception deep in the recursion because that means testing each integer for primeness, then storing that value in an array or however you wish to store all the values.
For any given number, you can find the first prime number by which it is evenly divisible by: beginning with the smallest number it may be divisible by (other than 1) and incrementing it until it is a number that evenly goes into the number in question.
You then have one factor (the divisor) and another value which needs to be factored (the quotient). If the quotient is 1, you're done.