Well it depends, and it depends on many things, the kind of problem and the difficulties you have with it, the kind of learning personality you are and so on. Some learn best when they are faced with a problem hands on, some learn best when they get a tool set before even getting close to a problem. As long as your difficulty is not “What am I supposed to do here” you should definitely try it yourself first. If this is the difficulty, take a deep breath and maybe a break, read the instructions carefully, google the related terms to get a feeling for it, break it down to smaller problems and then solve them. And maybe revisit your tool set. Knowing that you have a thorough understanding of all that is necessary to do it might already help a bit.
In case of factorial and prime numbers the problems are rather mathematical and the problem with maths is that it is a highly compressed and efficient language, meaning that the basic logic is mostly unbearably stupid but writing it efficient and stacking rules that seem to be stupid on there own lets you do stuff that comes close to magic. I mean think about it, we can formalize the rules of nature letting us predict events in the near future, that is literally some sort of wizardry. And it is derived from really basic and simple rules.
And in terms of prime numbers it the same. Prime numbers are just numbers that are only divisible by itself and by 1 (excluding 1 as both conditions need to apply). That’s it, nothing more. Fun fact: Almost all modern cryptography is based on them (but you probably don’t need to know this to program)
So to check for prime numbers is rather simple. You know by default that any number is divisible by 1 and itself so the only thing you need to make sure is that the only-part is fulfilled. Meaning you check any number from 2 to number-1
and if any of them divides the number without rest (does this ring a bell?) the number is not a prime, otherwise it is a prime.
PPS: As I just read that this is already said in the instruction. Maybe I just emphasize the two key points. You need to go through all the numbers between 2 and number-1. So what structure does this normally.
And the other thing is that you want to check if one number divides another number evenly or in other words you want to see if the remainder of a division is 0. What operator let’s you do this?
If you dig a bit deeper into maths you could verify that you in fact need much less then all numbers from 2 to number-1, which increases the speed a lot, but keep in mind the primary goal is to have something that works, when this is done you can improve it.
For the factorial part I actually don’t like the instructions. The definition about factorials is actually.
0! is 1
and for any integer n bigger than 0:
n! or factorial(n) is the same as n*factorial(n-1)
which makes a lot more sense when using the hint. Because this can be almost literally translated into code using a recursion. You’ve seen recursion yet, do you? if not that is what people mean when they wrongly reference inception
Meaning you call a function inside of a function opening another instance of this function. Factorial is actually the generic example too teach how recursions work so you’ll find countless examples how this works if you google for it. Or just ask, to understand them is not difficult but might be a little tedious.
Hope this helps a bit.
PS: As said for the exercises I’d more or less recommend to try to do them on your own as long as they aren’t too frustrating, most of them are not intended to be. But for real projects the problem is probably that there are no “solutions” as you might be one of the first to do it or better you need to find out what you’re actually searching for and there of course you don’t have to reinvent the wheel if you find a good solution use it, you can find problems anywhere solutions are more difficult to find