Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • \$\begingroup\$ Take input using input() would be much shorter \$\endgroup\$ Commented Sep 11, 2015 at 17:02
  • 10
    \$\begingroup\$ 52 bytes: n=m=int(input()), print(all(n%m for m in range(2,n))) \$\endgroup\$ Commented Sep 16, 2015 at 5:38
  • 4
    \$\begingroup\$ Are you serious. Spend 25 extra characters for a lame quadratic speedup? Here we hate bytes. We spend every hour,minute, and second of our lives getting rid of the nineteenth byte. (Just kidding. But we don't do time optimizations that increase program length.) \$\endgroup\$ Commented Mar 20, 2016 at 4:15
  • 2
    \$\begingroup\$ Use n%i<1 instead. \$\endgroup\$ Commented Oct 17, 2016 at 15:52
  • 1
    \$\begingroup\$ @SwimBikeRun, you're correct. Mine is only an improvement on John Lyon though it doesn't meet requirements for n < 2. Sorry for the confusion. \$\endgroup\$ Commented Aug 7, 2020 at 16:43