# sum of $n^{th}$ powers of prime factors of $x$

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)

-
In order to get the best possible answers, it is helpful if you say in what context you encountered the problem, and what your thoughts on it are so far; this will prevent people from telling you things you already know, and help them write their answers at an appropriate level. Also, many find the use of imperative ("Find") to be rude when asking for help; please consider rewriting your post. – Zev Chonoles Jun 2 '12 at 5:08
It is only a puzzle I came up with, and I don't have any ideas for $n>1$. – Angela Richardson Jun 2 '12 at 5:12
Your code doesn't seem to match the question. In the program it excludes primes that appear with multiplicity>1, i.e. unless t.count(e)==1. For example, with start=198 and power=2 it goes to $2^2+11^2=125$ and terminates, whereas from the question statement I would expect the next step to be $2^2+3^2+3^2+11^2=143$. – Zander Jun 2 '12 at 11:02