So im putting together a program that decompositions numbers on prefactors.
252=2^2 3^2 7^1 and 1944=2^3 3^5
Put this into tuples:
(wont use split, just for example)
[(2, 2), (3, 2), (7, 1)]
[(2, 3), (3, 5)]
This is the code that determines whether a given number is prime.
def prime(n ): for i in range(2, n): if n % i == 0: return False return True
So now I'm stuck here. I figured out what I must to next but can't seem to find the right code to do it. I need to write a function primes(n) that returns all the primes between 2(included) and n. Then I should write a fuction that tells me how many times the number n is divided by i - something like this:
devided (1944, 2)
Then I'm lost again. :-/