# Untitled

unknown
python
7 months ago
1.7 kB
0
Indexable
Never
```def prime_no(a):
for i in range(2,a-1):
if a%i ==0:
return False
return True

def firstfact(a):
if prime_no(a):
return(a)
factor=0
for i in range(2,a):
if a%i==0:
factor=i
return factor
break

def factorise(number,firstprime):
factorlist=[]
count=0
factorlist.append(firstprime)
if prime_no(number):
return(factorlist)
while True:
number=int(number/firstfact(number))
if prime_no(number):
factorlist.append(number)
return(factorlist)
break
factorlist.append(firstfact(number))

factorisation=[]

for i in range(2,21):
number=i
firstprime=firstfact(number)
factored=factorise(number,firstprime)
print(factored)
if set(factored).issubset(set(factorisation)):
print("yes this is happening")
continue
else:
for v in factored:
if v not in factorisation:
factorisation.append(v)

print(factorisation)

----------------------------
from math import sqrt

def prime_no(a):
for i in range(2,a-1):
if a%i ==0:
return False
return True

def firstfact(a):
factor=0
for i in range(2,(int(sqrt(a))+1)):
if prime_no(i):
if a%i==0:
factor=i
return factor
break

powers=[""]

for i in range(20):
a=i
if prime_no(i):
powers.append(i)
else:

()
```