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*

8
  • 1
    \$\begingroup\$ !p.equals(t.ONE) perhaps? Also, indexOf(n,1)-1 works I think. Or save 2 bytes and make it 1-indexed. \$\endgroup\$ Commented Apr 3, 2018 at 15:43
  • \$\begingroup\$ Not sure how I missed the first, but the second I really need to remember. Didn't knew there was an indexOf method that skips the first m characters. TIL, thanks! \$\endgroup\$ Commented Apr 3, 2018 at 15:50
  • 1
    \$\begingroup\$ How about keeping p an integer? \$\endgroup\$ Commented Apr 3, 2018 at 20:00
  • 1
    \$\begingroup\$ You can also decrement p by one each time (for(int p=667;p-->1;)), and then multiply by p and divide by p-~p. \$\endgroup\$ Commented Apr 4, 2018 at 8:28
  • 1
    \$\begingroup\$ The initial value of r can literally be anything, although extreme values will require more iterations. The best seed (fewest iterations) is actually 4e200. \$\endgroup\$ Commented Apr 4, 2018 at 10:02