Timeline for Is this number a prime?
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 5, 2021 at 9:28 | comment | added | l4m2 |
f=n=>/666/.test(d=n)&eval("for(;n%--d;)d<3")?n:f(n-1)
|
|
Mar 16, 2018 at 8:26 | comment | added | Scheintod | i<2 (and some text) | |
Oct 17, 2016 at 20:21 | comment | added | Hedi |
@Titus If the input is 1 the for loop will do n%--i once : 1%0 returns NaN and stops the loop. When alert is called i is already equal to 0 so 1==i returns false .
|
|
Oct 17, 2016 at 13:08 | comment | added | Titus |
should add n>1 to the final condition though, if You don´t want 1 to be prime.
|
|
Sep 24, 2016 at 8:46 | history | edited | Hedi | CC BY-SA 3.0 |
added 919 characters in body
|
Sep 24, 2016 at 1:48 | comment | added | ETHproductions |
Great answer! The &&i doesn't actually do anything in this program, so you can remove it.
|
|
Aug 27, 2016 at 0:48 | comment | added | Dennis | Welcome to Programming Puzzles & Code Golf! | |
Aug 26, 2016 at 23:34 | review | Late answers | |||
Aug 27, 2016 at 0:41 | |||||
Aug 26, 2016 at 23:11 | history | answered | Hedi | CC BY-SA 3.0 |