Python 2, (削除) 100 (削除ここまで) (削除) 99 (削除ここまで) (削除) 98 (削除ここまで) 96 bytes
n=input()
i=2
f=[]
while i<n:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving (削除) 1 (削除ここまで) 3 bytes!
Python 2, (削除) 100 (削除ここまで) (削除) 99 (削除ここまで) (削除) 98 (削除ここまで) 96 bytes
n=input()
i=2
f=[]
while i<n:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving (削除) 1 (削除ここまで) 3 bytes!
Python 2, (削除) 100 (削除ここまで) (削除) 99 (削除ここまで) (削除) 98 (削除ここまで) 96 bytes
n=input()
i=2
f=[]
while i<n:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving (削除) 1 (削除ここまで) 3 bytes!
Python 2, (削除) 100 (削除ここまで) (削除) 99 (削除ここまで) 98(削除) 98 (削除ここまで) 96 bytes
n=input()
i=2
f=[]
while i<1e5i<n:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving a byte(削除) 1 (削除ここまで) 3 bytes!
Python 2, (削除) 100 (削除ここまで) (削除) 99 (削除ここまで) 98 bytes
n=input()
i=2
f=[]
while i<1e5:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving a byte!
Python 2, (削除) 100 (削除ここまで) (削除) 99 (削除ここまで) (削除) 98 (削除ここまで) 96 bytes
n=input()
i=2
f=[]
while i<n:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving (削除) 1 (削除ここまで) 3 bytes!
Python 2, 100(削除) 100 (削除ここまで)(削除) 99 (削除ここまで) 98 bytes
n=input()
i=2
f=[]
while i*i<=ni<1e5:
if n%i:i+=1
else:n/=i;f+=i,
if n>1-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving a byte!
Python 2, 100 bytes
n=input()
i=2
f=[]
while i*i<=n:
if n%i:i+=1
else:n/=i;f+=i,
if n>1:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Python 2, (削除) 100 (削除ここまで)(削除) 99 (削除ここまで) 98 bytes
n=input()
i=2
f=[]
while i<1e5:
if n%i:i+=1
else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))
Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving a byte!