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

deleted 7 characters in body
Source Link
user96495
user96495

Io, 48 bytes

Port of @KevinCruijssen's Java@RobinRyder's R answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

Explanation

method(i, // Take an input
 c := 2 // Set counter to 2
 while(i%c>0, // While the input doesn't divide counter:
 c=c+1 // Increment counter
 )
 i log(c)%1==0 // Is the decimal part of input log counter equal to 0?
)

Io, 48 bytes

Port of @KevinCruijssen's Java answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

Explanation

method(i, // Take an input
 c := 2 // Set counter to 2
 while(i%c>0, // While the input doesn't divide counter:
 c=c+1 // Increment counter
 )
 i log(c)%1==0 // Is the decimal part of input log counter equal to 0?
)

Io, 48 bytes

Port of @RobinRyder's R answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

Explanation

method(i, // Take an input
 c := 2 // Set counter to 2
 while(i%c>0, // While the input doesn't divide counter:
 c=c+1 // Increment counter
 )
 i log(c)%1==0 // Is the decimal part of input log counter equal to 0?
)
added 453 characters in body
Source Link
user96495
user96495

Io, 48 bytes

Port of @KevinCruijssen's Java answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

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

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

Try it online!

Explanation

method(i, // Take an input
 c := 0 // Hold a counter of prime factors (c)
  t := 2 // Current iterationSet counter (t, starts fromto 2)
 while(t<=ii%c>0, // While the counter is less than i:
 if(i%t<1,  // If i isinput divisibledoesn't bydivide tcounter:
 c = c + 1 c=c+1 // Increment c
 while(i%t<1, // While i is divisible by t:
 i = i / t //  Divide i by tcounter
 )
 i log(c)
 t = t + 1 %1==0 // IncrementIs the counter
 )
 c < 2  decimal part //of Isinput thelog counter equal to 10?
)

Io, 48 bytes

Port of @KevinCruijssen's Java answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

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

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

Try it online!

Explanation

method(i, // Take an input
 c := 0 // Hold a counter of prime factors (c)
  t := 2 // Current iteration counter (t, starts from 2)
 while(t<=i, // While the counter is less than i:
 if(i%t<1,  // If i is divisible by t:
 c = c + 1  // Increment c
 while(i%t<1, // While i is divisible by t:
 i = i / t //  Divide i by t
 )
 )
 t = t + 1  // Increment the counter
 )
 c < 2  // Is the counter equal to 1?
)

Io, 48 bytes

Port of @KevinCruijssen's Java answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

Explanation

method(i, // Take an input
 c := 2 // Set counter to 2
 while(i%c>0, // While the input doesn't divide counter:
 c=c+1 // Increment counter
 )
 i log(c)%1==0 // Is the decimal part of input log counter equal to 0?
)
added 453 characters in body
Source Link
user96495
user96495

Io, 48 bytes

Port of @KevinCruijssen's Java answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

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

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

Try it online!

Explanation

method(i, // Take an input
 c := 0 // Hold a counter of prime factors (c)
 t := 2 // Current iteration counter (t, starts from 2)
 while(t<=i, // While the counter is less than i:
 if(i%t<1, // If i is divisible by t:
 c = c + 1 // Increment c
 while(i%t<1, // While i is divisible by t:
 i = i / t // Divide i by t
 )
 )
 t = t + 1 // Increment the counter
 )
 c < 2 // Is the counter equal to 1?
)

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

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

Try it online!

Explanation

method(i, // Take an input
 c := 0 // Hold a counter of prime factors (c)
 t := 2 // Current iteration counter (t, starts from 2)
 while(t<=i, // While the counter is less than i:
 if(i%t<1, // If i is divisible by t:
 c = c + 1 // Increment c
 while(i%t<1, // While i is divisible by t:
 i = i / t // Divide i by t
 )
 )
 t = t + 1 // Increment the counter
 )
 c < 2 // Is the counter equal to 1?
)

Io, 48 bytes

Port of @KevinCruijssen's Java answer.

method(i,c :=2;while(i%c>0,c=c+1);i log(c)%1==0)

Try it online!

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

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

Try it online!

Explanation

method(i, // Take an input
 c := 0 // Hold a counter of prime factors (c)
 t := 2 // Current iteration counter (t, starts from 2)
 while(t<=i, // While the counter is less than i:
 if(i%t<1, // If i is divisible by t:
 c = c + 1 // Increment c
 while(i%t<1, // While i is divisible by t:
 i = i / t // Divide i by t
 )
 )
 t = t + 1 // Increment the counter
 )
 c < 2 // Is the counter equal to 1?
)
added 45 characters in body
Source Link
user96495
user96495
Loading
added 574 characters in body
Source Link
user96495
user96495
Loading
deleted 598 characters in body
Source Link
user96495
user96495
Loading
added 117 characters in body
Source Link
user96495
user96495
Loading
added 2 characters in body
Source Link
user96495
user96495
Loading
Source Link
user96495
user96495
Loading

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