Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

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*

Required fields*

Notcalc (Calculate the wrong answer)

Goal:

Given two natural numbers (integers from 0 to infinity), output a number that is not the sum of those numbers, but is a natural number.

Example solutions (TI-Basic):

  • A+B+1

  • not(A+B)

Invalid solutions:

  • A+B-1 (for inputs 0,0, it returns -1, which is not natural)

  • "ABC" (ABC is not a number)

Notes:

  • The output must always be a sum of two natural numbers (which is actually just a natural number)

  • -1, undefined, infinity, NaN and Error messages are not natural numbers. For our purposes, 0 is natural (although not all mathematicians agree).

Answer*

Draft saved
Draft discarded
Cancel
8
  • 3
    \$\begingroup\$ The = solution also works in Jelly for 1 byte. I thought I'd mention it in the comments as it doesn't seem worth creating a separate answer for the trivial solution. \$\endgroup\$ Commented Feb 13, 2017 at 3:01
  • \$\begingroup\$ @ais523 Updated to include that. Thanks. \$\endgroup\$ Commented Feb 13, 2017 at 3:07
  • 2
    \$\begingroup\$ Also in Stacked. Try it online! \$\endgroup\$ Commented Feb 13, 2017 at 16:36
  • \$\begingroup\$ Can you add APL and J? \$\endgroup\$ Commented Feb 14, 2017 at 18:08
  • \$\begingroup\$ @Adám Sure thing. Do you have a TIO link that I can link to? \$\endgroup\$ Commented Feb 14, 2017 at 18:19

AltStyle によって変換されたページ (->オリジナル) /