Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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!

Saved 2 more bytes thanks to Leaky Nun
Source Link
Copper
  • 4k
  • 1
  • 14
  • 29

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!

Saved another byte
Source Link
Copper
  • 4k
  • 1
  • 14
  • 29

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!

Source Link
Copper
  • 4k
  • 1
  • 14
  • 29
Loading

AltStyle によって変換されたページ (->オリジナル) /