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*

3
  • 1
    \$\begingroup\$ It's not clear from the problem statement, but as long as n is guaranteed to not be negative then the condition can be reduced from n>0 to just n. \$\endgroup\$ Commented Aug 26, 2016 at 14:26
  • \$\begingroup\$ @JDL Nice ! Thanks ! \$\endgroup\$ Commented Aug 26, 2016 at 15:21
  • \$\begingroup\$ f(n-1) is 6 bytes. I think you save a byte by assigning it to something. i.e. ifelse(n,(a=f(n-1))^2-a+1,2) \$\endgroup\$ Commented Aug 26, 2016 at 16:58