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 Revisions

5 of 9
added 574 characters in body
user avatar
user avatar

Io, (削除) 85 (削除ここまで) 78 bytes

Doesn't work for huge numbers. Historical submissions

method(i,c :=0;i repeat(I,if(i%(I+2)<1,c=c+1;while(i%(I+2)<1,i=i/(I+2))));c<2)

Try it online!

Explanation

method(i, // Take an input
 c := 0 // Hold a counter of prime factors
 i repeat(I, // Repeat i times (counter I):
 if(i%(I+2)<1, // If i is divisible by I+2:
 c=c+1 // Add counter by 1
 while(i%(I+2)<1, // While i is divisible by I+2:
 i=i/(I+2) // Divide i by I+2
 )))
 c<2 // Is the factor counter equal to 1?
)
user96495

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