Find if a list is an ABC-triple












13














Three positive integers A, B, C are ABC-triple if they are coprime,
with A < B and satisfying the relation : A + B = C



Examples :





  • 1, 8, 9 is an ABC-triple since they are coprime, 1 < 8 and 1 + 8 = 9


  • 6, 8, 14 is not because they are not coprime


  • 7, 5, 12 is not because 7 > 5


You can see this Frits Beukers 2005 presentation for more details about ABC-triples.



Input/Output



Three integers, decimal written. May be separated values or
list. Output had to be a truthy/falsy value whether the three
integers are an ABC-triple.



Note: It is important to respect integers order in the list, for example: 1, 8, 9 is not considered as the same list as 9, 1, 8 or any other combination. So first is an ABC-triple and second is not.



Thus A is the first element of the list, B the second and C the third.



Test cases



Each of the following lists should output a truthy value



[1, 8, 9]
[2, 3, 5]
[2, 6436341, 6436343]
[4, 121, 125]
[121, 48234375, 48234496]


Each of the following lists should output a falsey value



[1, 1, 2]
[1, 2, 5]
[1, 9, 8]
[4, 12872682, 12872686]
[6, 8, 14]
[7, 5, 12]









share|improve this question
























  • Does the output have to be only one of two values, or can we output different truthy/falsy values for different inputs?
    – Luis Mendo
    20 hours ago










  • I think it should be consistent: your code have to output one kind of truthy/falsy values whatever the input. But the truthy/falsy couple can be what you want as far as it does the job: differentiate lists.
    – david
    19 hours ago












  • If we take the input as list of three values, does the input have to be in the order [A,B,C], or are we also allowed to take the input in the order [C,B,A] or [C,A,B]?
    – Kevin Cruijssen
    19 hours ago










  • You have to respect order since A < B is a criteria in the challenge.
    – david
    19 hours ago










  • @david A < B can still be respected when we take the input list in the order [C,A,B]. ;) But ok, perhaps it's indeed best to leave the input-order for lists-input as [A,B,C] to reduce confusion.
    – Kevin Cruijssen
    18 hours ago
















13














Three positive integers A, B, C are ABC-triple if they are coprime,
with A < B and satisfying the relation : A + B = C



Examples :





  • 1, 8, 9 is an ABC-triple since they are coprime, 1 < 8 and 1 + 8 = 9


  • 6, 8, 14 is not because they are not coprime


  • 7, 5, 12 is not because 7 > 5


You can see this Frits Beukers 2005 presentation for more details about ABC-triples.



Input/Output



Three integers, decimal written. May be separated values or
list. Output had to be a truthy/falsy value whether the three
integers are an ABC-triple.



Note: It is important to respect integers order in the list, for example: 1, 8, 9 is not considered as the same list as 9, 1, 8 or any other combination. So first is an ABC-triple and second is not.



Thus A is the first element of the list, B the second and C the third.



Test cases



Each of the following lists should output a truthy value



[1, 8, 9]
[2, 3, 5]
[2, 6436341, 6436343]
[4, 121, 125]
[121, 48234375, 48234496]


Each of the following lists should output a falsey value



[1, 1, 2]
[1, 2, 5]
[1, 9, 8]
[4, 12872682, 12872686]
[6, 8, 14]
[7, 5, 12]









share|improve this question
























  • Does the output have to be only one of two values, or can we output different truthy/falsy values for different inputs?
    – Luis Mendo
    20 hours ago










  • I think it should be consistent: your code have to output one kind of truthy/falsy values whatever the input. But the truthy/falsy couple can be what you want as far as it does the job: differentiate lists.
    – david
    19 hours ago












  • If we take the input as list of three values, does the input have to be in the order [A,B,C], or are we also allowed to take the input in the order [C,B,A] or [C,A,B]?
    – Kevin Cruijssen
    19 hours ago










  • You have to respect order since A < B is a criteria in the challenge.
    – david
    19 hours ago










  • @david A < B can still be respected when we take the input list in the order [C,A,B]. ;) But ok, perhaps it's indeed best to leave the input-order for lists-input as [A,B,C] to reduce confusion.
    – Kevin Cruijssen
    18 hours ago














13












13








13







Three positive integers A, B, C are ABC-triple if they are coprime,
with A < B and satisfying the relation : A + B = C



Examples :





  • 1, 8, 9 is an ABC-triple since they are coprime, 1 < 8 and 1 + 8 = 9


  • 6, 8, 14 is not because they are not coprime


  • 7, 5, 12 is not because 7 > 5


You can see this Frits Beukers 2005 presentation for more details about ABC-triples.



Input/Output



Three integers, decimal written. May be separated values or
list. Output had to be a truthy/falsy value whether the three
integers are an ABC-triple.



Note: It is important to respect integers order in the list, for example: 1, 8, 9 is not considered as the same list as 9, 1, 8 or any other combination. So first is an ABC-triple and second is not.



Thus A is the first element of the list, B the second and C the third.



Test cases



Each of the following lists should output a truthy value



[1, 8, 9]
[2, 3, 5]
[2, 6436341, 6436343]
[4, 121, 125]
[121, 48234375, 48234496]


Each of the following lists should output a falsey value



[1, 1, 2]
[1, 2, 5]
[1, 9, 8]
[4, 12872682, 12872686]
[6, 8, 14]
[7, 5, 12]









share|improve this question















Three positive integers A, B, C are ABC-triple if they are coprime,
with A < B and satisfying the relation : A + B = C



Examples :





  • 1, 8, 9 is an ABC-triple since they are coprime, 1 < 8 and 1 + 8 = 9


  • 6, 8, 14 is not because they are not coprime


  • 7, 5, 12 is not because 7 > 5


You can see this Frits Beukers 2005 presentation for more details about ABC-triples.



Input/Output



Three integers, decimal written. May be separated values or
list. Output had to be a truthy/falsy value whether the three
integers are an ABC-triple.



Note: It is important to respect integers order in the list, for example: 1, 8, 9 is not considered as the same list as 9, 1, 8 or any other combination. So first is an ABC-triple and second is not.



Thus A is the first element of the list, B the second and C the third.



Test cases



Each of the following lists should output a truthy value



[1, 8, 9]
[2, 3, 5]
[2, 6436341, 6436343]
[4, 121, 125]
[121, 48234375, 48234496]


Each of the following lists should output a falsey value



[1, 1, 2]
[1, 2, 5]
[1, 9, 8]
[4, 12872682, 12872686]
[6, 8, 14]
[7, 5, 12]






code-golf sequence decision-problem number-theory






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 16 hours ago

























asked 20 hours ago









david

199110




199110












  • Does the output have to be only one of two values, or can we output different truthy/falsy values for different inputs?
    – Luis Mendo
    20 hours ago










  • I think it should be consistent: your code have to output one kind of truthy/falsy values whatever the input. But the truthy/falsy couple can be what you want as far as it does the job: differentiate lists.
    – david
    19 hours ago












  • If we take the input as list of three values, does the input have to be in the order [A,B,C], or are we also allowed to take the input in the order [C,B,A] or [C,A,B]?
    – Kevin Cruijssen
    19 hours ago










  • You have to respect order since A < B is a criteria in the challenge.
    – david
    19 hours ago










  • @david A < B can still be respected when we take the input list in the order [C,A,B]. ;) But ok, perhaps it's indeed best to leave the input-order for lists-input as [A,B,C] to reduce confusion.
    – Kevin Cruijssen
    18 hours ago


















  • Does the output have to be only one of two values, or can we output different truthy/falsy values for different inputs?
    – Luis Mendo
    20 hours ago










  • I think it should be consistent: your code have to output one kind of truthy/falsy values whatever the input. But the truthy/falsy couple can be what you want as far as it does the job: differentiate lists.
    – david
    19 hours ago












  • If we take the input as list of three values, does the input have to be in the order [A,B,C], or are we also allowed to take the input in the order [C,B,A] or [C,A,B]?
    – Kevin Cruijssen
    19 hours ago










  • You have to respect order since A < B is a criteria in the challenge.
    – david
    19 hours ago










  • @david A < B can still be respected when we take the input list in the order [C,A,B]. ;) But ok, perhaps it's indeed best to leave the input-order for lists-input as [A,B,C] to reduce confusion.
    – Kevin Cruijssen
    18 hours ago
















Does the output have to be only one of two values, or can we output different truthy/falsy values for different inputs?
– Luis Mendo
20 hours ago




Does the output have to be only one of two values, or can we output different truthy/falsy values for different inputs?
– Luis Mendo
20 hours ago












I think it should be consistent: your code have to output one kind of truthy/falsy values whatever the input. But the truthy/falsy couple can be what you want as far as it does the job: differentiate lists.
– david
19 hours ago






I think it should be consistent: your code have to output one kind of truthy/falsy values whatever the input. But the truthy/falsy couple can be what you want as far as it does the job: differentiate lists.
– david
19 hours ago














If we take the input as list of three values, does the input have to be in the order [A,B,C], or are we also allowed to take the input in the order [C,B,A] or [C,A,B]?
– Kevin Cruijssen
19 hours ago




If we take the input as list of three values, does the input have to be in the order [A,B,C], or are we also allowed to take the input in the order [C,B,A] or [C,A,B]?
– Kevin Cruijssen
19 hours ago












You have to respect order since A < B is a criteria in the challenge.
– david
19 hours ago




You have to respect order since A < B is a criteria in the challenge.
– david
19 hours ago












@david A < B can still be respected when we take the input list in the order [C,A,B]. ;) But ok, perhaps it's indeed best to leave the input-order for lists-input as [A,B,C] to reduce confusion.
– Kevin Cruijssen
18 hours ago




@david A < B can still be respected when we take the input list in the order [C,A,B]. ;) But ok, perhaps it's indeed best to leave the input-order for lists-input as [A,B,C] to reduce confusion.
– Kevin Cruijssen
18 hours ago










20 Answers
20






active

oldest

votes


















7















Jelly, 10 9 bytes



Ṫ=S×</=g/


Try it online!



How it works



Ṫ=S×</=g/  Main link. Argument: [a, b, c] (positive integers)

Ṫ Tail; pop and yield c.
S Take the sum of [a, b], yielding (a + b).
= Yield t := (c == a + b).
</ Reduce by less than, yielding (a < b).
× Multiply, yielding t(a < b).
g/ Reduce by GCD, yielding gcd(a, b).
= Check if t(a < b) == gcd(a, b).





share|improve this answer































    7















    Perl 6, 33 32 bytes



    -1 byte thanks to nwellnhof





    {(.sum/.[2]/2*[<] $_)==[gcd] $_}


    Try it online!



    Anonymous code block that takes a list of three numbers and returns True or False.



    Explanation



    {                              }  # Anonymous code block
    [gcd] $_ # Is the gcd of all the numbers
    ( )== # Equal to
    .sum # Whether the sum of numbes
    / # Is equal to
    .[2]/2 # The last element doubled
    *[<] $_ # And elements are in ascending order





    share|improve this answer



















    • 2




      32 bytes
      – nwellnhof
      19 hours ago



















    6















    Haskell, 48 38 29 bytes





    -10 bytes due to TFeld's gcd trick!



    -7 bytes thanks to HPWiz for improving the co-primality test and spotting a superfluous space!



    -2 bytes thanks to nimi for suggesting an infix-operator!



    (a!b)c=a<b&&a+b==c&&gcd a b<2


    Try it online!



    Explanation



    The first two conditions a < b and a + b == c are fairly obvious, the third one uses that $gcd(a,b) = gcd(a,c) = gcd(b,c)$:



    Writing $gcd(a,c) = U cdot a + V cdot c$ using Bézout's identity and substituting $c = a + b$ gives:



    $$
    U cdot a + V cdot (a + b) = (U + V) cdot a + V cdot b
    $$



    Since the $gcd$ is the minimal positive solution to that identity it follows that $gcd(a,b) = gcd(a,c)$. The other case is symmetric.






    share|improve this answer



















    • 1




      Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
      – H.PWiz
      18 hours ago












    • @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
      – BMO
      18 hours ago



















    4














    Java 10, 65 64 bytes





    (a,b,c)->{var r=a<b&a+b==c;for(;b>0;a=b,b=c)c=a%b;return r&a<2;}


    -1 byte thank to @Shaggy.



    Try it online.



    Explanation:



    (a,b,c)->{        // Method with three integer parameters and boolean return-type
    var r= // Result-boolean, starting at:
    a<b // Check if `a` is smaller than `b`
    &a+b==c; // And if `a+b` is equal to `c`
    for(;b>0 // Then loop as long as `b` is not 0 yet
    ; // After every iteration:
    a=b, // Set `a` to the current `b`
    b=c) // And set `b` to the temp value `c`
    c=a%b; // Set the temp value `c` to `a` modulo-`b`
    // (we no longer need `c` at this point)
    return r // Return if the boolean-result is true
    &a<2;} // And `a` is now smaller than 2





    share|improve this answer























    • a==1 -> a<2 to save a byte.
      – Shaggy
      17 hours ago










    • @Shaggy Thanks!
      – Kevin Cruijssen
      15 hours ago



















    4















    05AB1E, 12 11 10 bytes



    Saved 1 byte thanks to Kevin Cruijssen



    ÂÆ_*`‹*¿Θ


    Try it online!
    or as a Test Suite



    Explanation



    ÂÆ           # reduce a reversed copy of the input by subtraction
    _ # logically negate
    * # multiply with input
    ` # push the values of the resulting list separately to stack
    # remove the top (last) value
    ‹ # is a < b ?
    * # multiply by the input list
    ¿ # calculate the gcd of the result
    Θ # is it true ?





    share|improve this answer























    • Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
      – Kevin Cruijssen
      17 hours ago










    • @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
      – Emigna
      15 hours ago



















    3















    Python 2, 69 67 63 62 55 bytes





    lambda a,b,c:(c-b==a<b)/gcd(a,b)
    from fractions import*


    Try it online!






    Python 3, 58 51 bytes





    lambda a,b,c:(c-b==a<b)==gcd(a,b)
    from math import*


    Try it online!





    -7 bytes, thanks to H.PWiz






    share|improve this answer























    • is the gcd in gcd trick valid? What if a is not coprime with c?
      – Jo King
      19 hours ago






    • 2




      @jo-king If p divides a and c, it should divide c-a so b.
      – david
      19 hours ago






    • 2




      @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
      – BMO
      19 hours ago










    • You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
      – H.PWiz
      18 hours ago










    • @H.PWiz Thanks :)
      – TFeld
      17 hours ago



















    3















    Japt, 16 14 13 11 bytes



    <V¥yU «NÔr-


    Try it



                    :Implicit input of integers U=A, V=B & W=C
    <V :Is U less than V?
    ¥ :Test that for equality with
    yU :The GCD of V & U
    « :Logical AND with the negation of
    N :The array of inputs
    Ô :Reversed
    r- :Reduced by subtraction





    share|improve this answer























    • Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
      – Kamil Drakari
      16 hours ago










    • @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
      – Shaggy
      14 hours ago



















    3














    JavaScript (ES6),  54 43 42  40 bytes



    Thanks to @Shaggy for pointing out that we don't need to compute $gcd(a,c)$. Saved 11 bytes by rewriting the code accordingly.



    Takes input as 3 separate integers. Returns $true$ for an ABC-triple, or either $0$ or $false$ otherwise.





    f=(a,b,c)=>c&&a/b|a+b-c?0:b?f(b,a%b):a<2


    Try it online!






    share|improve this answer



















    • 1




      I don't think you need to test gcd(c,a).
      – Shaggy
      16 hours ago










    • @Shaggy Thanks! I've rewritten the code entirely.
      – Arnauld
      16 hours ago



















    2














    Excel, 33 bytes



    =AND(A1+B1=C1,GCD(A1:C1)=1,A1<B1)





    share|improve this answer





























      2














      bash, 61 bytes





      factor $@|grep -vzP '( .+b).*n.*1b'&&(($1<$2&&$1+$2==$3))


      Try it online!



      Input as command line arguments,
      output in the exit code
      (also produces output on stdout as a side effect, but this can be ignored).



      The second part (starting from &&(() is pretty standard,
      but the interesting bit is the coprime test:



      factor $@      # produces output of the form "6: 2 3n8: 2 2 2n14: 2 7n"
      |grep - # regex search on the result
      v # invert the match (return truthy for strings that don't match)
      z # zero-terminated, allowing us to match newlines
      P # perl (extended) regex
      '( .+b)' # match one or more full factors
      '.*n.*' # and somewhere on the next line...
      '1b' # find the same full factors





      share|improve this answer





























        2














        Wolfram Language 24 30 28 bytes



        With 2 bytes saved by Doorknob,



        #<#2&&CoprimeQ@##&&#+#2==#3&





        share|improve this answer























        • Good catch! I had overlooked the constraint that # be less than #2.
          – DavidC
          15 hours ago












        • I think you should also be able to use CoprimeQ@## to save 2 bytes.
          – Doorknob
          15 hours ago










        • @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
          – DavidC
          14 hours ago










        • They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
          – Doorknob
          14 hours ago





















        2















        C# (Visual C# Interactive Compiler), 59 bytes





        (a,b,c)=>Enumerable.Range(2,a).All(i=>a%i+b%i>0)&a<b&a+b==c


        Try it online!






        share|improve this answer































          1















          J, 27 bytes



          (+/=2*{:)*({.<1{])*1=+./ .*


          Try it online!



          Inspired by Jo King's Perl solution






          share|improve this answer































            1















            C# (Visual C# Interactive Compiler), 90 bytes





            n=>new int[(int)1e8].Where((_,b)=>n[0]%++b<1&n[1]%b<1).Count()<2&n[0]+n[1]==n[2]&n[0]<n[1]


            Runs for numbers up to 1e8, takes about 35 seconds on my machine. Instead of calculating the gcd like others, the function just instantiate a huge array and filter the indexes that aren't divisors of a or b, and check how many elements are left. Next it check if element one plus element two equals element three. Lastly, it checks if the first element is less than the second.



            Try it online!






            share|improve this answer





























              1















              C# (.NET Core), 68 bytes



              Without Linq.





              (a,b,c)=>{var t=a<b&a+b==c;while(b>0){c=b;b=a%b;a=c;}return t&a<2;};


              Try it online!






              share|improve this answer





























                1















                Stax, 12 bytes



                ü╡v╕7+Pü°╔|g


                Run and debug it






                share|improve this answer





























                  1















                  Pari/GP, 30 bytes



                  Saved 2 bytes thanks to @Shaggy.



                  (a,b,c)->a<b==gcd(a,b)&&a+b==c


                  Try it online!






                  share|improve this answer



















                  • 1




                    30 bytes(?)
                    – Shaggy
                    11 hours ago



















                  0















                  Clean, 43 bytes



                  import StdEnv
                  $a b c=a<b&&a+b==c&&gcd a b<2


                  Try it online!



                  Similar to basically everything else because the direct test is the same.






                  share|improve this answer





























                    0















                    Retina 0.8.2, 40 bytes



                    d+
                    $*
                    A`^(11+)+,1+,
                    ^(1+),(1+1),12$


                    Try it online! Link includes test cases. Explanation:



                    d+
                    $*


                    Convert to unary.



                    A`^(11+)+,1+,


                    Check that A and B have no common factor.



                    ^(1+),(1+1),12$


                    Check that A < B and A + B = C.






                    share|improve this answer





























                      0















                      Befunge-98 (FBBI), 83 bytes



                      &:&:03p&:04pw>03g04g:v_1w03g04g+w1.@
                      00: 7j@.0[^j7 _^;>0.@;j7;>0.@;:%g00p


                      Try it online!



                      The input which is a triple of integers [A,B,C] is feeded into Befunge as space-separated integers C B A.






                      share|improve this answer








                      New contributor




                      Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.


















                        Your Answer





                        StackExchange.ifUsing("editor", function () {
                        return StackExchange.using("mathjaxEditing", function () {
                        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                        });
                        });
                        }, "mathjax-editing");

                        StackExchange.ifUsing("editor", function () {
                        StackExchange.using("externalEditor", function () {
                        StackExchange.using("snippets", function () {
                        StackExchange.snippets.init();
                        });
                        });
                        }, "code-snippets");

                        StackExchange.ready(function() {
                        var channelOptions = {
                        tags: "".split(" "),
                        id: "200"
                        };
                        initTagRenderer("".split(" "), "".split(" "), channelOptions);

                        StackExchange.using("externalEditor", function() {
                        // Have to fire editor after snippets, if snippets enabled
                        if (StackExchange.settings.snippets.snippetsEnabled) {
                        StackExchange.using("snippets", function() {
                        createEditor();
                        });
                        }
                        else {
                        createEditor();
                        }
                        });

                        function createEditor() {
                        StackExchange.prepareEditor({
                        heartbeatType: 'answer',
                        autoActivateHeartbeat: false,
                        convertImagesToLinks: false,
                        noModals: true,
                        showLowRepImageUploadWarning: true,
                        reputationToPostImages: null,
                        bindNavPrevention: true,
                        postfix: "",
                        imageUploader: {
                        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                        allowUrls: true
                        },
                        onDemand: true,
                        discardSelector: ".discard-answer"
                        ,immediatelyShowMarkdownHelp:true
                        });


                        }
                        });














                        draft saved

                        draft discarded


















                        StackExchange.ready(
                        function () {
                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f178303%2ffind-if-a-list-is-an-abc-triple%23new-answer', 'question_page');
                        }
                        );

                        Post as a guest















                        Required, but never shown

























                        20 Answers
                        20






                        active

                        oldest

                        votes








                        20 Answers
                        20






                        active

                        oldest

                        votes









                        active

                        oldest

                        votes






                        active

                        oldest

                        votes









                        7















                        Jelly, 10 9 bytes



                        Ṫ=S×</=g/


                        Try it online!



                        How it works



                        Ṫ=S×</=g/  Main link. Argument: [a, b, c] (positive integers)

                        Ṫ Tail; pop and yield c.
                        S Take the sum of [a, b], yielding (a + b).
                        = Yield t := (c == a + b).
                        </ Reduce by less than, yielding (a < b).
                        × Multiply, yielding t(a < b).
                        g/ Reduce by GCD, yielding gcd(a, b).
                        = Check if t(a < b) == gcd(a, b).





                        share|improve this answer




























                          7















                          Jelly, 10 9 bytes



                          Ṫ=S×</=g/


                          Try it online!



                          How it works



                          Ṫ=S×</=g/  Main link. Argument: [a, b, c] (positive integers)

                          Ṫ Tail; pop and yield c.
                          S Take the sum of [a, b], yielding (a + b).
                          = Yield t := (c == a + b).
                          </ Reduce by less than, yielding (a < b).
                          × Multiply, yielding t(a < b).
                          g/ Reduce by GCD, yielding gcd(a, b).
                          = Check if t(a < b) == gcd(a, b).





                          share|improve this answer


























                            7












                            7








                            7







                            Jelly, 10 9 bytes



                            Ṫ=S×</=g/


                            Try it online!



                            How it works



                            Ṫ=S×</=g/  Main link. Argument: [a, b, c] (positive integers)

                            Ṫ Tail; pop and yield c.
                            S Take the sum of [a, b], yielding (a + b).
                            = Yield t := (c == a + b).
                            </ Reduce by less than, yielding (a < b).
                            × Multiply, yielding t(a < b).
                            g/ Reduce by GCD, yielding gcd(a, b).
                            = Check if t(a < b) == gcd(a, b).





                            share|improve this answer















                            Jelly, 10 9 bytes



                            Ṫ=S×</=g/


                            Try it online!



                            How it works



                            Ṫ=S×</=g/  Main link. Argument: [a, b, c] (positive integers)

                            Ṫ Tail; pop and yield c.
                            S Take the sum of [a, b], yielding (a + b).
                            = Yield t := (c == a + b).
                            </ Reduce by less than, yielding (a < b).
                            × Multiply, yielding t(a < b).
                            g/ Reduce by GCD, yielding gcd(a, b).
                            = Check if t(a < b) == gcd(a, b).






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 15 hours ago

























                            answered 18 hours ago









                            Dennis

                            186k32297735




                            186k32297735























                                7















                                Perl 6, 33 32 bytes



                                -1 byte thanks to nwellnhof





                                {(.sum/.[2]/2*[<] $_)==[gcd] $_}


                                Try it online!



                                Anonymous code block that takes a list of three numbers and returns True or False.



                                Explanation



                                {                              }  # Anonymous code block
                                [gcd] $_ # Is the gcd of all the numbers
                                ( )== # Equal to
                                .sum # Whether the sum of numbes
                                / # Is equal to
                                .[2]/2 # The last element doubled
                                *[<] $_ # And elements are in ascending order





                                share|improve this answer



















                                • 2




                                  32 bytes
                                  – nwellnhof
                                  19 hours ago
















                                7















                                Perl 6, 33 32 bytes



                                -1 byte thanks to nwellnhof





                                {(.sum/.[2]/2*[<] $_)==[gcd] $_}


                                Try it online!



                                Anonymous code block that takes a list of three numbers and returns True or False.



                                Explanation



                                {                              }  # Anonymous code block
                                [gcd] $_ # Is the gcd of all the numbers
                                ( )== # Equal to
                                .sum # Whether the sum of numbes
                                / # Is equal to
                                .[2]/2 # The last element doubled
                                *[<] $_ # And elements are in ascending order





                                share|improve this answer



















                                • 2




                                  32 bytes
                                  – nwellnhof
                                  19 hours ago














                                7












                                7








                                7







                                Perl 6, 33 32 bytes



                                -1 byte thanks to nwellnhof





                                {(.sum/.[2]/2*[<] $_)==[gcd] $_}


                                Try it online!



                                Anonymous code block that takes a list of three numbers and returns True or False.



                                Explanation



                                {                              }  # Anonymous code block
                                [gcd] $_ # Is the gcd of all the numbers
                                ( )== # Equal to
                                .sum # Whether the sum of numbes
                                / # Is equal to
                                .[2]/2 # The last element doubled
                                *[<] $_ # And elements are in ascending order





                                share|improve this answer















                                Perl 6, 33 32 bytes



                                -1 byte thanks to nwellnhof





                                {(.sum/.[2]/2*[<] $_)==[gcd] $_}


                                Try it online!



                                Anonymous code block that takes a list of three numbers and returns True or False.



                                Explanation



                                {                              }  # Anonymous code block
                                [gcd] $_ # Is the gcd of all the numbers
                                ( )== # Equal to
                                .sum # Whether the sum of numbes
                                / # Is equal to
                                .[2]/2 # The last element doubled
                                *[<] $_ # And elements are in ascending order






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 10 hours ago

























                                answered 19 hours ago









                                Jo King

                                20.9k248110




                                20.9k248110








                                • 2




                                  32 bytes
                                  – nwellnhof
                                  19 hours ago














                                • 2




                                  32 bytes
                                  – nwellnhof
                                  19 hours ago








                                2




                                2




                                32 bytes
                                – nwellnhof
                                19 hours ago




                                32 bytes
                                – nwellnhof
                                19 hours ago











                                6















                                Haskell, 48 38 29 bytes





                                -10 bytes due to TFeld's gcd trick!



                                -7 bytes thanks to HPWiz for improving the co-primality test and spotting a superfluous space!



                                -2 bytes thanks to nimi for suggesting an infix-operator!



                                (a!b)c=a<b&&a+b==c&&gcd a b<2


                                Try it online!



                                Explanation



                                The first two conditions a < b and a + b == c are fairly obvious, the third one uses that $gcd(a,b) = gcd(a,c) = gcd(b,c)$:



                                Writing $gcd(a,c) = U cdot a + V cdot c$ using Bézout's identity and substituting $c = a + b$ gives:



                                $$
                                U cdot a + V cdot (a + b) = (U + V) cdot a + V cdot b
                                $$



                                Since the $gcd$ is the minimal positive solution to that identity it follows that $gcd(a,b) = gcd(a,c)$. The other case is symmetric.






                                share|improve this answer



















                                • 1




                                  Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
                                  – H.PWiz
                                  18 hours ago












                                • @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
                                  – BMO
                                  18 hours ago
















                                6















                                Haskell, 48 38 29 bytes





                                -10 bytes due to TFeld's gcd trick!



                                -7 bytes thanks to HPWiz for improving the co-primality test and spotting a superfluous space!



                                -2 bytes thanks to nimi for suggesting an infix-operator!



                                (a!b)c=a<b&&a+b==c&&gcd a b<2


                                Try it online!



                                Explanation



                                The first two conditions a < b and a + b == c are fairly obvious, the third one uses that $gcd(a,b) = gcd(a,c) = gcd(b,c)$:



                                Writing $gcd(a,c) = U cdot a + V cdot c$ using Bézout's identity and substituting $c = a + b$ gives:



                                $$
                                U cdot a + V cdot (a + b) = (U + V) cdot a + V cdot b
                                $$



                                Since the $gcd$ is the minimal positive solution to that identity it follows that $gcd(a,b) = gcd(a,c)$. The other case is symmetric.






                                share|improve this answer



















                                • 1




                                  Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
                                  – H.PWiz
                                  18 hours ago












                                • @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
                                  – BMO
                                  18 hours ago














                                6












                                6








                                6







                                Haskell, 48 38 29 bytes





                                -10 bytes due to TFeld's gcd trick!



                                -7 bytes thanks to HPWiz for improving the co-primality test and spotting a superfluous space!



                                -2 bytes thanks to nimi for suggesting an infix-operator!



                                (a!b)c=a<b&&a+b==c&&gcd a b<2


                                Try it online!



                                Explanation



                                The first two conditions a < b and a + b == c are fairly obvious, the third one uses that $gcd(a,b) = gcd(a,c) = gcd(b,c)$:



                                Writing $gcd(a,c) = U cdot a + V cdot c$ using Bézout's identity and substituting $c = a + b$ gives:



                                $$
                                U cdot a + V cdot (a + b) = (U + V) cdot a + V cdot b
                                $$



                                Since the $gcd$ is the minimal positive solution to that identity it follows that $gcd(a,b) = gcd(a,c)$. The other case is symmetric.






                                share|improve this answer















                                Haskell, 48 38 29 bytes





                                -10 bytes due to TFeld's gcd trick!



                                -7 bytes thanks to HPWiz for improving the co-primality test and spotting a superfluous space!



                                -2 bytes thanks to nimi for suggesting an infix-operator!



                                (a!b)c=a<b&&a+b==c&&gcd a b<2


                                Try it online!



                                Explanation



                                The first two conditions a < b and a + b == c are fairly obvious, the third one uses that $gcd(a,b) = gcd(a,c) = gcd(b,c)$:



                                Writing $gcd(a,c) = U cdot a + V cdot c$ using Bézout's identity and substituting $c = a + b$ gives:



                                $$
                                U cdot a + V cdot (a + b) = (U + V) cdot a + V cdot b
                                $$



                                Since the $gcd$ is the minimal positive solution to that identity it follows that $gcd(a,b) = gcd(a,c)$. The other case is symmetric.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 14 hours ago

























                                answered 19 hours ago









                                BMO

                                11.5k22187




                                11.5k22187








                                • 1




                                  Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
                                  – H.PWiz
                                  18 hours ago












                                • @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
                                  – BMO
                                  18 hours ago














                                • 1




                                  Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
                                  – H.PWiz
                                  18 hours ago












                                • @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
                                  – BMO
                                  18 hours ago








                                1




                                1




                                Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
                                – H.PWiz
                                18 hours ago






                                Also, I believe you only need that gcd a b==1. Since gcd a b divides a+b=c. i.e gcd(gcd a b)c=gcd a b
                                – H.PWiz
                                18 hours ago














                                @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
                                – BMO
                                18 hours ago




                                @HPWiz: Ah yes,of course, thanks! Will edit later when not on mobile..
                                – BMO
                                18 hours ago











                                4














                                Java 10, 65 64 bytes





                                (a,b,c)->{var r=a<b&a+b==c;for(;b>0;a=b,b=c)c=a%b;return r&a<2;}


                                -1 byte thank to @Shaggy.



                                Try it online.



                                Explanation:



                                (a,b,c)->{        // Method with three integer parameters and boolean return-type
                                var r= // Result-boolean, starting at:
                                a<b // Check if `a` is smaller than `b`
                                &a+b==c; // And if `a+b` is equal to `c`
                                for(;b>0 // Then loop as long as `b` is not 0 yet
                                ; // After every iteration:
                                a=b, // Set `a` to the current `b`
                                b=c) // And set `b` to the temp value `c`
                                c=a%b; // Set the temp value `c` to `a` modulo-`b`
                                // (we no longer need `c` at this point)
                                return r // Return if the boolean-result is true
                                &a<2;} // And `a` is now smaller than 2





                                share|improve this answer























                                • a==1 -> a<2 to save a byte.
                                  – Shaggy
                                  17 hours ago










                                • @Shaggy Thanks!
                                  – Kevin Cruijssen
                                  15 hours ago
















                                4














                                Java 10, 65 64 bytes





                                (a,b,c)->{var r=a<b&a+b==c;for(;b>0;a=b,b=c)c=a%b;return r&a<2;}


                                -1 byte thank to @Shaggy.



                                Try it online.



                                Explanation:



                                (a,b,c)->{        // Method with three integer parameters and boolean return-type
                                var r= // Result-boolean, starting at:
                                a<b // Check if `a` is smaller than `b`
                                &a+b==c; // And if `a+b` is equal to `c`
                                for(;b>0 // Then loop as long as `b` is not 0 yet
                                ; // After every iteration:
                                a=b, // Set `a` to the current `b`
                                b=c) // And set `b` to the temp value `c`
                                c=a%b; // Set the temp value `c` to `a` modulo-`b`
                                // (we no longer need `c` at this point)
                                return r // Return if the boolean-result is true
                                &a<2;} // And `a` is now smaller than 2





                                share|improve this answer























                                • a==1 -> a<2 to save a byte.
                                  – Shaggy
                                  17 hours ago










                                • @Shaggy Thanks!
                                  – Kevin Cruijssen
                                  15 hours ago














                                4












                                4








                                4






                                Java 10, 65 64 bytes





                                (a,b,c)->{var r=a<b&a+b==c;for(;b>0;a=b,b=c)c=a%b;return r&a<2;}


                                -1 byte thank to @Shaggy.



                                Try it online.



                                Explanation:



                                (a,b,c)->{        // Method with three integer parameters and boolean return-type
                                var r= // Result-boolean, starting at:
                                a<b // Check if `a` is smaller than `b`
                                &a+b==c; // And if `a+b` is equal to `c`
                                for(;b>0 // Then loop as long as `b` is not 0 yet
                                ; // After every iteration:
                                a=b, // Set `a` to the current `b`
                                b=c) // And set `b` to the temp value `c`
                                c=a%b; // Set the temp value `c` to `a` modulo-`b`
                                // (we no longer need `c` at this point)
                                return r // Return if the boolean-result is true
                                &a<2;} // And `a` is now smaller than 2





                                share|improve this answer














                                Java 10, 65 64 bytes





                                (a,b,c)->{var r=a<b&a+b==c;for(;b>0;a=b,b=c)c=a%b;return r&a<2;}


                                -1 byte thank to @Shaggy.



                                Try it online.



                                Explanation:



                                (a,b,c)->{        // Method with three integer parameters and boolean return-type
                                var r= // Result-boolean, starting at:
                                a<b // Check if `a` is smaller than `b`
                                &a+b==c; // And if `a+b` is equal to `c`
                                for(;b>0 // Then loop as long as `b` is not 0 yet
                                ; // After every iteration:
                                a=b, // Set `a` to the current `b`
                                b=c) // And set `b` to the temp value `c`
                                c=a%b; // Set the temp value `c` to `a` modulo-`b`
                                // (we no longer need `c` at this point)
                                return r // Return if the boolean-result is true
                                &a<2;} // And `a` is now smaller than 2






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 15 hours ago

























                                answered 17 hours ago









                                Kevin Cruijssen

                                35.7k554187




                                35.7k554187












                                • a==1 -> a<2 to save a byte.
                                  – Shaggy
                                  17 hours ago










                                • @Shaggy Thanks!
                                  – Kevin Cruijssen
                                  15 hours ago


















                                • a==1 -> a<2 to save a byte.
                                  – Shaggy
                                  17 hours ago










                                • @Shaggy Thanks!
                                  – Kevin Cruijssen
                                  15 hours ago
















                                a==1 -> a<2 to save a byte.
                                – Shaggy
                                17 hours ago




                                a==1 -> a<2 to save a byte.
                                – Shaggy
                                17 hours ago












                                @Shaggy Thanks!
                                – Kevin Cruijssen
                                15 hours ago




                                @Shaggy Thanks!
                                – Kevin Cruijssen
                                15 hours ago











                                4















                                05AB1E, 12 11 10 bytes



                                Saved 1 byte thanks to Kevin Cruijssen



                                ÂÆ_*`‹*¿Θ


                                Try it online!
                                or as a Test Suite



                                Explanation



                                ÂÆ           # reduce a reversed copy of the input by subtraction
                                _ # logically negate
                                * # multiply with input
                                ` # push the values of the resulting list separately to stack
                                # remove the top (last) value
                                ‹ # is a < b ?
                                * # multiply by the input list
                                ¿ # calculate the gcd of the result
                                Θ # is it true ?





                                share|improve this answer























                                • Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
                                  – Kevin Cruijssen
                                  17 hours ago










                                • @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
                                  – Emigna
                                  15 hours ago
















                                4















                                05AB1E, 12 11 10 bytes



                                Saved 1 byte thanks to Kevin Cruijssen



                                ÂÆ_*`‹*¿Θ


                                Try it online!
                                or as a Test Suite



                                Explanation



                                ÂÆ           # reduce a reversed copy of the input by subtraction
                                _ # logically negate
                                * # multiply with input
                                ` # push the values of the resulting list separately to stack
                                # remove the top (last) value
                                ‹ # is a < b ?
                                * # multiply by the input list
                                ¿ # calculate the gcd of the result
                                Θ # is it true ?





                                share|improve this answer























                                • Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
                                  – Kevin Cruijssen
                                  17 hours ago










                                • @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
                                  – Emigna
                                  15 hours ago














                                4












                                4








                                4







                                05AB1E, 12 11 10 bytes



                                Saved 1 byte thanks to Kevin Cruijssen



                                ÂÆ_*`‹*¿Θ


                                Try it online!
                                or as a Test Suite



                                Explanation



                                ÂÆ           # reduce a reversed copy of the input by subtraction
                                _ # logically negate
                                * # multiply with input
                                ` # push the values of the resulting list separately to stack
                                # remove the top (last) value
                                ‹ # is a < b ?
                                * # multiply by the input list
                                ¿ # calculate the gcd of the result
                                Θ # is it true ?





                                share|improve this answer















                                05AB1E, 12 11 10 bytes



                                Saved 1 byte thanks to Kevin Cruijssen



                                ÂÆ_*`‹*¿Θ


                                Try it online!
                                or as a Test Suite



                                Explanation



                                ÂÆ           # reduce a reversed copy of the input by subtraction
                                _ # logically negate
                                * # multiply with input
                                ` # push the values of the resulting list separately to stack
                                # remove the top (last) value
                                ‹ # is a < b ?
                                * # multiply by the input list
                                ¿ # calculate the gcd of the result
                                Θ # is it true ?






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 15 hours ago

























                                answered 19 hours ago









                                Emigna

                                45.4k432138




                                45.4k432138












                                • Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
                                  – Kevin Cruijssen
                                  17 hours ago










                                • @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
                                  – Emigna
                                  15 hours ago


















                                • Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
                                  – Kevin Cruijssen
                                  17 hours ago










                                • @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
                                  – Emigna
                                  15 hours ago
















                                Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
                                – Kevin Cruijssen
                                17 hours ago




                                Oops.. deleted my comment.. >.> So again: you can save a byte by using multiples instead of swaps with product: RÆ_*`‹*¿Θ Test Suite.
                                – Kevin Cruijssen
                                17 hours ago












                                @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
                                – Emigna
                                15 hours ago




                                @KevinCruijssen: Thanks! Yeah, usually when you have that many swaps, you're doing something wrong :P
                                – Emigna
                                15 hours ago











                                3















                                Python 2, 69 67 63 62 55 bytes





                                lambda a,b,c:(c-b==a<b)/gcd(a,b)
                                from fractions import*


                                Try it online!






                                Python 3, 58 51 bytes





                                lambda a,b,c:(c-b==a<b)==gcd(a,b)
                                from math import*


                                Try it online!





                                -7 bytes, thanks to H.PWiz






                                share|improve this answer























                                • is the gcd in gcd trick valid? What if a is not coprime with c?
                                  – Jo King
                                  19 hours ago






                                • 2




                                  @jo-king If p divides a and c, it should divide c-a so b.
                                  – david
                                  19 hours ago






                                • 2




                                  @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
                                  – BMO
                                  19 hours ago










                                • You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
                                  – H.PWiz
                                  18 hours ago










                                • @H.PWiz Thanks :)
                                  – TFeld
                                  17 hours ago
















                                3















                                Python 2, 69 67 63 62 55 bytes





                                lambda a,b,c:(c-b==a<b)/gcd(a,b)
                                from fractions import*


                                Try it online!






                                Python 3, 58 51 bytes





                                lambda a,b,c:(c-b==a<b)==gcd(a,b)
                                from math import*


                                Try it online!





                                -7 bytes, thanks to H.PWiz






                                share|improve this answer























                                • is the gcd in gcd trick valid? What if a is not coprime with c?
                                  – Jo King
                                  19 hours ago






                                • 2




                                  @jo-king If p divides a and c, it should divide c-a so b.
                                  – david
                                  19 hours ago






                                • 2




                                  @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
                                  – BMO
                                  19 hours ago










                                • You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
                                  – H.PWiz
                                  18 hours ago










                                • @H.PWiz Thanks :)
                                  – TFeld
                                  17 hours ago














                                3












                                3








                                3







                                Python 2, 69 67 63 62 55 bytes





                                lambda a,b,c:(c-b==a<b)/gcd(a,b)
                                from fractions import*


                                Try it online!






                                Python 3, 58 51 bytes





                                lambda a,b,c:(c-b==a<b)==gcd(a,b)
                                from math import*


                                Try it online!





                                -7 bytes, thanks to H.PWiz






                                share|improve this answer















                                Python 2, 69 67 63 62 55 bytes





                                lambda a,b,c:(c-b==a<b)/gcd(a,b)
                                from fractions import*


                                Try it online!






                                Python 3, 58 51 bytes





                                lambda a,b,c:(c-b==a<b)==gcd(a,b)
                                from math import*


                                Try it online!





                                -7 bytes, thanks to H.PWiz







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 17 hours ago

























                                answered 19 hours ago









                                TFeld

                                14.3k21240




                                14.3k21240












                                • is the gcd in gcd trick valid? What if a is not coprime with c?
                                  – Jo King
                                  19 hours ago






                                • 2




                                  @jo-king If p divides a and c, it should divide c-a so b.
                                  – david
                                  19 hours ago






                                • 2




                                  @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
                                  – BMO
                                  19 hours ago










                                • You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
                                  – H.PWiz
                                  18 hours ago










                                • @H.PWiz Thanks :)
                                  – TFeld
                                  17 hours ago


















                                • is the gcd in gcd trick valid? What if a is not coprime with c?
                                  – Jo King
                                  19 hours ago






                                • 2




                                  @jo-king If p divides a and c, it should divide c-a so b.
                                  – david
                                  19 hours ago






                                • 2




                                  @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
                                  – BMO
                                  19 hours ago










                                • You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
                                  – H.PWiz
                                  18 hours ago










                                • @H.PWiz Thanks :)
                                  – TFeld
                                  17 hours ago
















                                is the gcd in gcd trick valid? What if a is not coprime with c?
                                – Jo King
                                19 hours ago




                                is the gcd in gcd trick valid? What if a is not coprime with c?
                                – Jo King
                                19 hours ago




                                2




                                2




                                @jo-king If p divides a and c, it should divide c-a so b.
                                – david
                                19 hours ago




                                @jo-king If p divides a and c, it should divide c-a so b.
                                – david
                                19 hours ago




                                2




                                2




                                @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
                                – BMO
                                19 hours ago




                                @JoKing: It is in this case, but not in general (you can prove it via Bezout's identity).
                                – BMO
                                19 hours ago












                                You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
                                – H.PWiz
                                18 hours ago




                                You can take it one step further and use gcd(a,b), since gcd(a,b) divides a+b
                                – H.PWiz
                                18 hours ago












                                @H.PWiz Thanks :)
                                – TFeld
                                17 hours ago




                                @H.PWiz Thanks :)
                                – TFeld
                                17 hours ago











                                3















                                Japt, 16 14 13 11 bytes



                                <V¥yU «NÔr-


                                Try it



                                                :Implicit input of integers U=A, V=B & W=C
                                <V :Is U less than V?
                                ¥ :Test that for equality with
                                yU :The GCD of V & U
                                « :Logical AND with the negation of
                                N :The array of inputs
                                Ô :Reversed
                                r- :Reduced by subtraction





                                share|improve this answer























                                • Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
                                  – Kamil Drakari
                                  16 hours ago










                                • @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
                                  – Shaggy
                                  14 hours ago
















                                3















                                Japt, 16 14 13 11 bytes



                                <V¥yU «NÔr-


                                Try it



                                                :Implicit input of integers U=A, V=B & W=C
                                <V :Is U less than V?
                                ¥ :Test that for equality with
                                yU :The GCD of V & U
                                « :Logical AND with the negation of
                                N :The array of inputs
                                Ô :Reversed
                                r- :Reduced by subtraction





                                share|improve this answer























                                • Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
                                  – Kamil Drakari
                                  16 hours ago










                                • @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
                                  – Shaggy
                                  14 hours ago














                                3












                                3








                                3







                                Japt, 16 14 13 11 bytes



                                <V¥yU «NÔr-


                                Try it



                                                :Implicit input of integers U=A, V=B & W=C
                                <V :Is U less than V?
                                ¥ :Test that for equality with
                                yU :The GCD of V & U
                                « :Logical AND with the negation of
                                N :The array of inputs
                                Ô :Reversed
                                r- :Reduced by subtraction





                                share|improve this answer















                                Japt, 16 14 13 11 bytes



                                <V¥yU «NÔr-


                                Try it



                                                :Implicit input of integers U=A, V=B & W=C
                                <V :Is U less than V?
                                ¥ :Test that for equality with
                                yU :The GCD of V & U
                                « :Logical AND with the negation of
                                N :The array of inputs
                                Ô :Reversed
                                r- :Reduced by subtraction






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 17 hours ago

























                                answered 19 hours ago









                                Shaggy

                                19k21666




                                19k21666












                                • Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
                                  – Kamil Drakari
                                  16 hours ago










                                • @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
                                  – Shaggy
                                  14 hours ago


















                                • Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
                                  – Kamil Drakari
                                  16 hours ago










                                • @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
                                  – Shaggy
                                  14 hours ago
















                                Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
                                – Kamil Drakari
                                16 hours ago




                                Here is another 11 byte solution, though on closer inspection it isn't much different from yours in its actual logic.
                                – Kamil Drakari
                                16 hours ago












                                @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
                                – Shaggy
                                14 hours ago




                                @KamilDrakari, had a variation on that at one stage, too. It could be 10 bytes if variables were auto-inserted when > follows ©.
                                – Shaggy
                                14 hours ago











                                3














                                JavaScript (ES6),  54 43 42  40 bytes



                                Thanks to @Shaggy for pointing out that we don't need to compute $gcd(a,c)$. Saved 11 bytes by rewriting the code accordingly.



                                Takes input as 3 separate integers. Returns $true$ for an ABC-triple, or either $0$ or $false$ otherwise.





                                f=(a,b,c)=>c&&a/b|a+b-c?0:b?f(b,a%b):a<2


                                Try it online!






                                share|improve this answer



















                                • 1




                                  I don't think you need to test gcd(c,a).
                                  – Shaggy
                                  16 hours ago










                                • @Shaggy Thanks! I've rewritten the code entirely.
                                  – Arnauld
                                  16 hours ago
















                                3














                                JavaScript (ES6),  54 43 42  40 bytes



                                Thanks to @Shaggy for pointing out that we don't need to compute $gcd(a,c)$. Saved 11 bytes by rewriting the code accordingly.



                                Takes input as 3 separate integers. Returns $true$ for an ABC-triple, or either $0$ or $false$ otherwise.





                                f=(a,b,c)=>c&&a/b|a+b-c?0:b?f(b,a%b):a<2


                                Try it online!






                                share|improve this answer



















                                • 1




                                  I don't think you need to test gcd(c,a).
                                  – Shaggy
                                  16 hours ago










                                • @Shaggy Thanks! I've rewritten the code entirely.
                                  – Arnauld
                                  16 hours ago














                                3












                                3








                                3






                                JavaScript (ES6),  54 43 42  40 bytes



                                Thanks to @Shaggy for pointing out that we don't need to compute $gcd(a,c)$. Saved 11 bytes by rewriting the code accordingly.



                                Takes input as 3 separate integers. Returns $true$ for an ABC-triple, or either $0$ or $false$ otherwise.





                                f=(a,b,c)=>c&&a/b|a+b-c?0:b?f(b,a%b):a<2


                                Try it online!






                                share|improve this answer














                                JavaScript (ES6),  54 43 42  40 bytes



                                Thanks to @Shaggy for pointing out that we don't need to compute $gcd(a,c)$. Saved 11 bytes by rewriting the code accordingly.



                                Takes input as 3 separate integers. Returns $true$ for an ABC-triple, or either $0$ or $false$ otherwise.





                                f=(a,b,c)=>c&&a/b|a+b-c?0:b?f(b,a%b):a<2


                                Try it online!







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 16 hours ago

























                                answered 19 hours ago









                                Arnauld

                                72.5k689305




                                72.5k689305








                                • 1




                                  I don't think you need to test gcd(c,a).
                                  – Shaggy
                                  16 hours ago










                                • @Shaggy Thanks! I've rewritten the code entirely.
                                  – Arnauld
                                  16 hours ago














                                • 1




                                  I don't think you need to test gcd(c,a).
                                  – Shaggy
                                  16 hours ago










                                • @Shaggy Thanks! I've rewritten the code entirely.
                                  – Arnauld
                                  16 hours ago








                                1




                                1




                                I don't think you need to test gcd(c,a).
                                – Shaggy
                                16 hours ago




                                I don't think you need to test gcd(c,a).
                                – Shaggy
                                16 hours ago












                                @Shaggy Thanks! I've rewritten the code entirely.
                                – Arnauld
                                16 hours ago




                                @Shaggy Thanks! I've rewritten the code entirely.
                                – Arnauld
                                16 hours ago











                                2














                                Excel, 33 bytes



                                =AND(A1+B1=C1,GCD(A1:C1)=1,A1<B1)





                                share|improve this answer


























                                  2














                                  Excel, 33 bytes



                                  =AND(A1+B1=C1,GCD(A1:C1)=1,A1<B1)





                                  share|improve this answer
























                                    2












                                    2








                                    2






                                    Excel, 33 bytes



                                    =AND(A1+B1=C1,GCD(A1:C1)=1,A1<B1)





                                    share|improve this answer












                                    Excel, 33 bytes



                                    =AND(A1+B1=C1,GCD(A1:C1)=1,A1<B1)






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 17 hours ago









                                    Wernisch

                                    1,597317




                                    1,597317























                                        2














                                        bash, 61 bytes





                                        factor $@|grep -vzP '( .+b).*n.*1b'&&(($1<$2&&$1+$2==$3))


                                        Try it online!



                                        Input as command line arguments,
                                        output in the exit code
                                        (also produces output on stdout as a side effect, but this can be ignored).



                                        The second part (starting from &&(() is pretty standard,
                                        but the interesting bit is the coprime test:



                                        factor $@      # produces output of the form "6: 2 3n8: 2 2 2n14: 2 7n"
                                        |grep - # regex search on the result
                                        v # invert the match (return truthy for strings that don't match)
                                        z # zero-terminated, allowing us to match newlines
                                        P # perl (extended) regex
                                        '( .+b)' # match one or more full factors
                                        '.*n.*' # and somewhere on the next line...
                                        '1b' # find the same full factors





                                        share|improve this answer


























                                          2














                                          bash, 61 bytes





                                          factor $@|grep -vzP '( .+b).*n.*1b'&&(($1<$2&&$1+$2==$3))


                                          Try it online!



                                          Input as command line arguments,
                                          output in the exit code
                                          (also produces output on stdout as a side effect, but this can be ignored).



                                          The second part (starting from &&(() is pretty standard,
                                          but the interesting bit is the coprime test:



                                          factor $@      # produces output of the form "6: 2 3n8: 2 2 2n14: 2 7n"
                                          |grep - # regex search on the result
                                          v # invert the match (return truthy for strings that don't match)
                                          z # zero-terminated, allowing us to match newlines
                                          P # perl (extended) regex
                                          '( .+b)' # match one or more full factors
                                          '.*n.*' # and somewhere on the next line...
                                          '1b' # find the same full factors





                                          share|improve this answer
























                                            2












                                            2








                                            2






                                            bash, 61 bytes





                                            factor $@|grep -vzP '( .+b).*n.*1b'&&(($1<$2&&$1+$2==$3))


                                            Try it online!



                                            Input as command line arguments,
                                            output in the exit code
                                            (also produces output on stdout as a side effect, but this can be ignored).



                                            The second part (starting from &&(() is pretty standard,
                                            but the interesting bit is the coprime test:



                                            factor $@      # produces output of the form "6: 2 3n8: 2 2 2n14: 2 7n"
                                            |grep - # regex search on the result
                                            v # invert the match (return truthy for strings that don't match)
                                            z # zero-terminated, allowing us to match newlines
                                            P # perl (extended) regex
                                            '( .+b)' # match one or more full factors
                                            '.*n.*' # and somewhere on the next line...
                                            '1b' # find the same full factors





                                            share|improve this answer












                                            bash, 61 bytes





                                            factor $@|grep -vzP '( .+b).*n.*1b'&&(($1<$2&&$1+$2==$3))


                                            Try it online!



                                            Input as command line arguments,
                                            output in the exit code
                                            (also produces output on stdout as a side effect, but this can be ignored).



                                            The second part (starting from &&(() is pretty standard,
                                            but the interesting bit is the coprime test:



                                            factor $@      # produces output of the form "6: 2 3n8: 2 2 2n14: 2 7n"
                                            |grep - # regex search on the result
                                            v # invert the match (return truthy for strings that don't match)
                                            z # zero-terminated, allowing us to match newlines
                                            P # perl (extended) regex
                                            '( .+b)' # match one or more full factors
                                            '.*n.*' # and somewhere on the next line...
                                            '1b' # find the same full factors






                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered 16 hours ago









                                            Doorknob

                                            54.3k17113346




                                            54.3k17113346























                                                2














                                                Wolfram Language 24 30 28 bytes



                                                With 2 bytes saved by Doorknob,



                                                #<#2&&CoprimeQ@##&&#+#2==#3&





                                                share|improve this answer























                                                • Good catch! I had overlooked the constraint that # be less than #2.
                                                  – DavidC
                                                  15 hours ago












                                                • I think you should also be able to use CoprimeQ@## to save 2 bytes.
                                                  – Doorknob
                                                  15 hours ago










                                                • @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
                                                  – DavidC
                                                  14 hours ago










                                                • They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
                                                  – Doorknob
                                                  14 hours ago


















                                                2














                                                Wolfram Language 24 30 28 bytes



                                                With 2 bytes saved by Doorknob,



                                                #<#2&&CoprimeQ@##&&#+#2==#3&





                                                share|improve this answer























                                                • Good catch! I had overlooked the constraint that # be less than #2.
                                                  – DavidC
                                                  15 hours ago












                                                • I think you should also be able to use CoprimeQ@## to save 2 bytes.
                                                  – Doorknob
                                                  15 hours ago










                                                • @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
                                                  – DavidC
                                                  14 hours ago










                                                • They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
                                                  – Doorknob
                                                  14 hours ago
















                                                2












                                                2








                                                2






                                                Wolfram Language 24 30 28 bytes



                                                With 2 bytes saved by Doorknob,



                                                #<#2&&CoprimeQ@##&&#+#2==#3&





                                                share|improve this answer














                                                Wolfram Language 24 30 28 bytes



                                                With 2 bytes saved by Doorknob,



                                                #<#2&&CoprimeQ@##&&#+#2==#3&






                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited 14 hours ago

























                                                answered 17 hours ago









                                                DavidC

                                                23.9k243102




                                                23.9k243102












                                                • Good catch! I had overlooked the constraint that # be less than #2.
                                                  – DavidC
                                                  15 hours ago












                                                • I think you should also be able to use CoprimeQ@## to save 2 bytes.
                                                  – Doorknob
                                                  15 hours ago










                                                • @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
                                                  – DavidC
                                                  14 hours ago










                                                • They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
                                                  – Doorknob
                                                  14 hours ago




















                                                • Good catch! I had overlooked the constraint that # be less than #2.
                                                  – DavidC
                                                  15 hours ago












                                                • I think you should also be able to use CoprimeQ@## to save 2 bytes.
                                                  – Doorknob
                                                  15 hours ago










                                                • @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
                                                  – DavidC
                                                  14 hours ago










                                                • They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
                                                  – Doorknob
                                                  14 hours ago


















                                                Good catch! I had overlooked the constraint that # be less than #2.
                                                – DavidC
                                                15 hours ago






                                                Good catch! I had overlooked the constraint that # be less than #2.
                                                – DavidC
                                                15 hours ago














                                                I think you should also be able to use CoprimeQ@## to save 2 bytes.
                                                – Doorknob
                                                15 hours ago




                                                I think you should also be able to use CoprimeQ@## to save 2 bytes.
                                                – Doorknob
                                                15 hours ago












                                                @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
                                                – DavidC
                                                14 hours ago




                                                @Doorknob, If the first and second numbers are coprime, are they necessarily coprime with their sum?
                                                – DavidC
                                                14 hours ago












                                                They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
                                                – Doorknob
                                                14 hours ago






                                                They are, but the original definition actually states that A, B, and C should be coprime. Most answers check only A and B just because it's usually shorter.
                                                – Doorknob
                                                14 hours ago













                                                2















                                                C# (Visual C# Interactive Compiler), 59 bytes





                                                (a,b,c)=>Enumerable.Range(2,a).All(i=>a%i+b%i>0)&a<b&a+b==c


                                                Try it online!






                                                share|improve this answer




























                                                  2















                                                  C# (Visual C# Interactive Compiler), 59 bytes





                                                  (a,b,c)=>Enumerable.Range(2,a).All(i=>a%i+b%i>0)&a<b&a+b==c


                                                  Try it online!






                                                  share|improve this answer


























                                                    2












                                                    2








                                                    2







                                                    C# (Visual C# Interactive Compiler), 59 bytes





                                                    (a,b,c)=>Enumerable.Range(2,a).All(i=>a%i+b%i>0)&a<b&a+b==c


                                                    Try it online!






                                                    share|improve this answer















                                                    C# (Visual C# Interactive Compiler), 59 bytes





                                                    (a,b,c)=>Enumerable.Range(2,a).All(i=>a%i+b%i>0)&a<b&a+b==c


                                                    Try it online!







                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited 13 hours ago

























                                                    answered 14 hours ago









                                                    dana

                                                    48135




                                                    48135























                                                        1















                                                        J, 27 bytes



                                                        (+/=2*{:)*({.<1{])*1=+./ .*


                                                        Try it online!



                                                        Inspired by Jo King's Perl solution






                                                        share|improve this answer




























                                                          1















                                                          J, 27 bytes



                                                          (+/=2*{:)*({.<1{])*1=+./ .*


                                                          Try it online!



                                                          Inspired by Jo King's Perl solution






                                                          share|improve this answer


























                                                            1












                                                            1








                                                            1







                                                            J, 27 bytes



                                                            (+/=2*{:)*({.<1{])*1=+./ .*


                                                            Try it online!



                                                            Inspired by Jo King's Perl solution






                                                            share|improve this answer















                                                            J, 27 bytes



                                                            (+/=2*{:)*({.<1{])*1=+./ .*


                                                            Try it online!



                                                            Inspired by Jo King's Perl solution







                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited 18 hours ago

























                                                            answered 19 hours ago









                                                            Galen Ivanov

                                                            6,35711032




                                                            6,35711032























                                                                1















                                                                C# (Visual C# Interactive Compiler), 90 bytes





                                                                n=>new int[(int)1e8].Where((_,b)=>n[0]%++b<1&n[1]%b<1).Count()<2&n[0]+n[1]==n[2]&n[0]<n[1]


                                                                Runs for numbers up to 1e8, takes about 35 seconds on my machine. Instead of calculating the gcd like others, the function just instantiate a huge array and filter the indexes that aren't divisors of a or b, and check how many elements are left. Next it check if element one plus element two equals element three. Lastly, it checks if the first element is less than the second.



                                                                Try it online!






                                                                share|improve this answer


























                                                                  1















                                                                  C# (Visual C# Interactive Compiler), 90 bytes





                                                                  n=>new int[(int)1e8].Where((_,b)=>n[0]%++b<1&n[1]%b<1).Count()<2&n[0]+n[1]==n[2]&n[0]<n[1]


                                                                  Runs for numbers up to 1e8, takes about 35 seconds on my machine. Instead of calculating the gcd like others, the function just instantiate a huge array and filter the indexes that aren't divisors of a or b, and check how many elements are left. Next it check if element one plus element two equals element three. Lastly, it checks if the first element is less than the second.



                                                                  Try it online!






                                                                  share|improve this answer
























                                                                    1












                                                                    1








                                                                    1







                                                                    C# (Visual C# Interactive Compiler), 90 bytes





                                                                    n=>new int[(int)1e8].Where((_,b)=>n[0]%++b<1&n[1]%b<1).Count()<2&n[0]+n[1]==n[2]&n[0]<n[1]


                                                                    Runs for numbers up to 1e8, takes about 35 seconds on my machine. Instead of calculating the gcd like others, the function just instantiate a huge array and filter the indexes that aren't divisors of a or b, and check how many elements are left. Next it check if element one plus element two equals element three. Lastly, it checks if the first element is less than the second.



                                                                    Try it online!






                                                                    share|improve this answer













                                                                    C# (Visual C# Interactive Compiler), 90 bytes





                                                                    n=>new int[(int)1e8].Where((_,b)=>n[0]%++b<1&n[1]%b<1).Count()<2&n[0]+n[1]==n[2]&n[0]<n[1]


                                                                    Runs for numbers up to 1e8, takes about 35 seconds on my machine. Instead of calculating the gcd like others, the function just instantiate a huge array and filter the indexes that aren't divisors of a or b, and check how many elements are left. Next it check if element one plus element two equals element three. Lastly, it checks if the first element is less than the second.



                                                                    Try it online!







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered 15 hours ago









                                                                    Embodiment of Ignorance

                                                                    48014




                                                                    48014























                                                                        1















                                                                        C# (.NET Core), 68 bytes



                                                                        Without Linq.





                                                                        (a,b,c)=>{var t=a<b&a+b==c;while(b>0){c=b;b=a%b;a=c;}return t&a<2;};


                                                                        Try it online!






                                                                        share|improve this answer


























                                                                          1















                                                                          C# (.NET Core), 68 bytes



                                                                          Without Linq.





                                                                          (a,b,c)=>{var t=a<b&a+b==c;while(b>0){c=b;b=a%b;a=c;}return t&a<2;};


                                                                          Try it online!






                                                                          share|improve this answer
























                                                                            1












                                                                            1








                                                                            1







                                                                            C# (.NET Core), 68 bytes



                                                                            Without Linq.





                                                                            (a,b,c)=>{var t=a<b&a+b==c;while(b>0){c=b;b=a%b;a=c;}return t&a<2;};


                                                                            Try it online!






                                                                            share|improve this answer













                                                                            C# (.NET Core), 68 bytes



                                                                            Without Linq.





                                                                            (a,b,c)=>{var t=a<b&a+b==c;while(b>0){c=b;b=a%b;a=c;}return t&a<2;};


                                                                            Try it online!







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered 14 hours ago









                                                                            Destroigo

                                                                            713




                                                                            713























                                                                                1















                                                                                Stax, 12 bytes



                                                                                ü╡v╕7+Pü°╔|g


                                                                                Run and debug it






                                                                                share|improve this answer


























                                                                                  1















                                                                                  Stax, 12 bytes



                                                                                  ü╡v╕7+Pü°╔|g


                                                                                  Run and debug it






                                                                                  share|improve this answer
























                                                                                    1












                                                                                    1








                                                                                    1







                                                                                    Stax, 12 bytes



                                                                                    ü╡v╕7+Pü°╔|g


                                                                                    Run and debug it






                                                                                    share|improve this answer













                                                                                    Stax, 12 bytes



                                                                                    ü╡v╕7+Pü°╔|g


                                                                                    Run and debug it







                                                                                    share|improve this answer












                                                                                    share|improve this answer



                                                                                    share|improve this answer










                                                                                    answered 14 hours ago









                                                                                    wastl

                                                                                    2,084425




                                                                                    2,084425























                                                                                        1















                                                                                        Pari/GP, 30 bytes



                                                                                        Saved 2 bytes thanks to @Shaggy.



                                                                                        (a,b,c)->a<b==gcd(a,b)&&a+b==c


                                                                                        Try it online!






                                                                                        share|improve this answer



















                                                                                        • 1




                                                                                          30 bytes(?)
                                                                                          – Shaggy
                                                                                          11 hours ago
















                                                                                        1















                                                                                        Pari/GP, 30 bytes



                                                                                        Saved 2 bytes thanks to @Shaggy.



                                                                                        (a,b,c)->a<b==gcd(a,b)&&a+b==c


                                                                                        Try it online!






                                                                                        share|improve this answer



















                                                                                        • 1




                                                                                          30 bytes(?)
                                                                                          – Shaggy
                                                                                          11 hours ago














                                                                                        1












                                                                                        1








                                                                                        1







                                                                                        Pari/GP, 30 bytes



                                                                                        Saved 2 bytes thanks to @Shaggy.



                                                                                        (a,b,c)->a<b==gcd(a,b)&&a+b==c


                                                                                        Try it online!






                                                                                        share|improve this answer















                                                                                        Pari/GP, 30 bytes



                                                                                        Saved 2 bytes thanks to @Shaggy.



                                                                                        (a,b,c)->a<b==gcd(a,b)&&a+b==c


                                                                                        Try it online!







                                                                                        share|improve this answer














                                                                                        share|improve this answer



                                                                                        share|improve this answer








                                                                                        edited 8 hours ago

























                                                                                        answered 15 hours ago









                                                                                        alephalpha

                                                                                        21.2k32989




                                                                                        21.2k32989








                                                                                        • 1




                                                                                          30 bytes(?)
                                                                                          – Shaggy
                                                                                          11 hours ago














                                                                                        • 1




                                                                                          30 bytes(?)
                                                                                          – Shaggy
                                                                                          11 hours ago








                                                                                        1




                                                                                        1




                                                                                        30 bytes(?)
                                                                                        – Shaggy
                                                                                        11 hours ago




                                                                                        30 bytes(?)
                                                                                        – Shaggy
                                                                                        11 hours ago











                                                                                        0















                                                                                        Clean, 43 bytes



                                                                                        import StdEnv
                                                                                        $a b c=a<b&&a+b==c&&gcd a b<2


                                                                                        Try it online!



                                                                                        Similar to basically everything else because the direct test is the same.






                                                                                        share|improve this answer


























                                                                                          0















                                                                                          Clean, 43 bytes



                                                                                          import StdEnv
                                                                                          $a b c=a<b&&a+b==c&&gcd a b<2


                                                                                          Try it online!



                                                                                          Similar to basically everything else because the direct test is the same.






                                                                                          share|improve this answer
























                                                                                            0












                                                                                            0








                                                                                            0







                                                                                            Clean, 43 bytes



                                                                                            import StdEnv
                                                                                            $a b c=a<b&&a+b==c&&gcd a b<2


                                                                                            Try it online!



                                                                                            Similar to basically everything else because the direct test is the same.






                                                                                            share|improve this answer













                                                                                            Clean, 43 bytes



                                                                                            import StdEnv
                                                                                            $a b c=a<b&&a+b==c&&gcd a b<2


                                                                                            Try it online!



                                                                                            Similar to basically everything else because the direct test is the same.







                                                                                            share|improve this answer












                                                                                            share|improve this answer



                                                                                            share|improve this answer










                                                                                            answered 14 hours ago









                                                                                            Οurous

                                                                                            6,48211033




                                                                                            6,48211033























                                                                                                0















                                                                                                Retina 0.8.2, 40 bytes



                                                                                                d+
                                                                                                $*
                                                                                                A`^(11+)+,1+,
                                                                                                ^(1+),(1+1),12$


                                                                                                Try it online! Link includes test cases. Explanation:



                                                                                                d+
                                                                                                $*


                                                                                                Convert to unary.



                                                                                                A`^(11+)+,1+,


                                                                                                Check that A and B have no common factor.



                                                                                                ^(1+),(1+1),12$


                                                                                                Check that A < B and A + B = C.






                                                                                                share|improve this answer


























                                                                                                  0















                                                                                                  Retina 0.8.2, 40 bytes



                                                                                                  d+
                                                                                                  $*
                                                                                                  A`^(11+)+,1+,
                                                                                                  ^(1+),(1+1),12$


                                                                                                  Try it online! Link includes test cases. Explanation:



                                                                                                  d+
                                                                                                  $*


                                                                                                  Convert to unary.



                                                                                                  A`^(11+)+,1+,


                                                                                                  Check that A and B have no common factor.



                                                                                                  ^(1+),(1+1),12$


                                                                                                  Check that A < B and A + B = C.






                                                                                                  share|improve this answer
























                                                                                                    0












                                                                                                    0








                                                                                                    0







                                                                                                    Retina 0.8.2, 40 bytes



                                                                                                    d+
                                                                                                    $*
                                                                                                    A`^(11+)+,1+,
                                                                                                    ^(1+),(1+1),12$


                                                                                                    Try it online! Link includes test cases. Explanation:



                                                                                                    d+
                                                                                                    $*


                                                                                                    Convert to unary.



                                                                                                    A`^(11+)+,1+,


                                                                                                    Check that A and B have no common factor.



                                                                                                    ^(1+),(1+1),12$


                                                                                                    Check that A < B and A + B = C.






                                                                                                    share|improve this answer













                                                                                                    Retina 0.8.2, 40 bytes



                                                                                                    d+
                                                                                                    $*
                                                                                                    A`^(11+)+,1+,
                                                                                                    ^(1+),(1+1),12$


                                                                                                    Try it online! Link includes test cases. Explanation:



                                                                                                    d+
                                                                                                    $*


                                                                                                    Convert to unary.



                                                                                                    A`^(11+)+,1+,


                                                                                                    Check that A and B have no common factor.



                                                                                                    ^(1+),(1+1),12$


                                                                                                    Check that A < B and A + B = C.







                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered 9 hours ago









                                                                                                    Neil

                                                                                                    79.4k744177




                                                                                                    79.4k744177























                                                                                                        0















                                                                                                        Befunge-98 (FBBI), 83 bytes



                                                                                                        &:&:03p&:04pw>03g04g:v_1w03g04g+w1.@
                                                                                                        00: 7j@.0[^j7 _^;>0.@;j7;>0.@;:%g00p


                                                                                                        Try it online!



                                                                                                        The input which is a triple of integers [A,B,C] is feeded into Befunge as space-separated integers C B A.






                                                                                                        share|improve this answer








                                                                                                        New contributor




                                                                                                        Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                        Check out our Code of Conduct.























                                                                                                          0















                                                                                                          Befunge-98 (FBBI), 83 bytes



                                                                                                          &:&:03p&:04pw>03g04g:v_1w03g04g+w1.@
                                                                                                          00: 7j@.0[^j7 _^;>0.@;j7;>0.@;:%g00p


                                                                                                          Try it online!



                                                                                                          The input which is a triple of integers [A,B,C] is feeded into Befunge as space-separated integers C B A.






                                                                                                          share|improve this answer








                                                                                                          New contributor




                                                                                                          Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                          Check out our Code of Conduct.





















                                                                                                            0












                                                                                                            0








                                                                                                            0







                                                                                                            Befunge-98 (FBBI), 83 bytes



                                                                                                            &:&:03p&:04pw>03g04g:v_1w03g04g+w1.@
                                                                                                            00: 7j@.0[^j7 _^;>0.@;j7;>0.@;:%g00p


                                                                                                            Try it online!



                                                                                                            The input which is a triple of integers [A,B,C] is feeded into Befunge as space-separated integers C B A.






                                                                                                            share|improve this answer








                                                                                                            New contributor




                                                                                                            Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.










                                                                                                            Befunge-98 (FBBI), 83 bytes



                                                                                                            &:&:03p&:04pw>03g04g:v_1w03g04g+w1.@
                                                                                                            00: 7j@.0[^j7 _^;>0.@;j7;>0.@;:%g00p


                                                                                                            Try it online!



                                                                                                            The input which is a triple of integers [A,B,C] is feeded into Befunge as space-separated integers C B A.







                                                                                                            share|improve this answer








                                                                                                            New contributor




                                                                                                            Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.









                                                                                                            share|improve this answer



                                                                                                            share|improve this answer






                                                                                                            New contributor




                                                                                                            Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.









                                                                                                            answered 6 hours ago









                                                                                                            Wisław

                                                                                                            101




                                                                                                            101




                                                                                                            New contributor




                                                                                                            Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.





                                                                                                            New contributor





                                                                                                            Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.






                                                                                                            Wisław is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.






























                                                                                                                draft saved

                                                                                                                draft discarded




















































                                                                                                                If this is an answer to a challenge…




                                                                                                                • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                  Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                More generally…




                                                                                                                • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                • …Avoid asking for help, clarification or responding to other answers (use comments instead).






                                                                                                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                                                                Please pay close attention to the following guidance:


                                                                                                                • Please be sure to answer the question. Provide details and share your research!

                                                                                                                But avoid



                                                                                                                • Asking for help, clarification, or responding to other answers.

                                                                                                                • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                To learn more, see our tips on writing great answers.




                                                                                                                draft saved


                                                                                                                draft discarded














                                                                                                                StackExchange.ready(
                                                                                                                function () {
                                                                                                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f178303%2ffind-if-a-list-is-an-abc-triple%23new-answer', 'question_page');
                                                                                                                }
                                                                                                                );

                                                                                                                Post as a guest















                                                                                                                Required, but never shown





















































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown

































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown







                                                                                                                Popular posts from this blog

                                                                                                                Eda skans

                                                                                                                William S. Burroughs

                                                                                                                What is the difference between apt, apt-get and git?