Starting with a positive integer $x$, find the sum of the $n^{th}$ powers of the prime factors of $x$, including multiplicities. Then find the sum of the $n^{th}$ prime factors of the result etc. until an $n^{th}$ power of a prime is reached. Will the sequence always terminate, or can it get caught in a loop or diverge to infinity?
python code for creating this sequence:
def factor(n):
m,p,r,k=n,3,7,[]
while m%2==0:
k.append(2)
r=1
m=m/2
while p<=n**0.5 and m!=1:
if m%p==0:
k.append(p)
r=1
m=m/p
else:
p+=2
if r==1:
while p<=n and m!=1:
if m%p==0:
k.append(p)
m=m/p
else:
p+=2
return k
y=1
x,n=int(input("start")),int(input("power"))
while x!=y and x!=0:
y,x=x,0
t=factor(y)
for e in t:
x+=e**n
print(x)