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*

7
  • \$\begingroup\$ -1:x+1 will save you a byte, but 0:45 will save you three and cover the required range \$\endgroup\$ Commented Jun 14, 2017 at 20:39
  • \$\begingroup\$ @MickyT Oh, I must've overlooked the required range specification. Thanks :) \$\endgroup\$ Commented Jun 14, 2017 at 20:42
  • \$\begingroup\$ An alternative approach, only 36 bytes: pryr::f(any(!(5*n^2+c(-4,4))^.5%%1)). \$\endgroup\$ Commented Jun 16, 2017 at 8:12
  • \$\begingroup\$ I got it down to 32 bytes, see here. \$\endgroup\$ Commented Jun 16, 2017 at 9:58
  • \$\begingroup\$ I'm not so familiar with code golf rules -- does allowing non-base packages make sense? I could write arbitrary R code into a package, install it, and run it the same way you have run the function from pryr. \$\endgroup\$ Commented Jun 16, 2017 at 12:58