g | x | w | all
Bytes Lang Time Link
068Tcl171023T161808Zsergiol
008Uiua241205T140644Znyxbird
046AWK241202T195851Zxrs
065Swift 6240907T225849ZmacOSist
007Husk240907T185354ZGlory2Uk
014Wolfram Language Mathematica201021T180138ZRoman
4375Vyxal220127T050941Zlyxal
005Thunno 2230609T143252ZThe Thon
048MS Excel171029T223752ZTaylor R
044Rust210302T193421ZAiden4
140Templates Considered Harmful210302T153244ZZack C.
010GolfScript201021T163814Z2014MELO
008Japt171023T171358ZShaggy
014APL NARS171225T214753Zuser5898
007Japt190203T042121ZOliver
047Excel180626T105719ZWernisch
090Lua180620T020534ZAlex All
045JavaScript Node.js180619T214532ZUmbrella
044PHP180619T213352ZUmbrella
342Perl 5171023T151444ZNahuel F
014Julia 0.6180615T202634ZSundar R
031Triangularity180202T103519ZMr. Xcod
010J171023T152827ZJonah
006Pyt171225T152607Zmudkip20
00505AB1E180202T125057ZErik the
040JavaScript 6171226T105312Zl4m2
nan171128T191254ZTornado5
037Python 2171023T145319ZErik the
010CJam171023T205224Zkaine
066Lua171026T131714ZMCAdvent
064Common Lisp171029T211753ZRenzo
006Ohm v2171023T153821ZCinaski
039Axiom171029T231724Zuser5898
049Excel VBA171029T223921ZTaylor R
057Triangular171026T205710ZMickyT
024Pari/GP171023T230804ZJeppe St
013MY171023T202218ZAdalynn
047PHP171027T160935ZCalimero
008Pushy171024T102821ZFlipTack
094Go171023T231229ZRiking
009CJam171026T130559Zaditsu q
010TIBasic171024T105922ZTimtech
029Octave171024T113934ZBass
005Jelly171023T144640Zuser2027
068Java OpenJDK 8171023T145244ZRoberto
023Jq 1.5171024T065400Zjq170727
016Julia 0.6171024T023819ZDennis
032GNUOctave171025T041334ZIEatBage
018Stacked171025T033914ZConor O&
011CJam171024T220550ZEsolangi
018Add++171024T220120Zcaird co
031Ruby171024T192302Zanna328p
024Mathematica 39171023T153432ZDavidC
00605AB1E171023T150852ZOkx
053C#171024T134313ZAbbas
016Dyalog APL171023T151147ZJ. Sall&
068Swift 4171024T105400Zxoudini
nan171023T151837ZSteadybo
049C gcc171024T093705ZPopeko
nan171024T082850ZToby Spe
010APL Dyalog171024T082329ZAdá
043Python 2171023T144017ZTFeld
010Pyth171023T174825ZL3viatha
068BrainFlak171024T013803ZNitrodon
031R171023T195022ZMickyT
060Racket171023T160133ZMisha La
010RProgN 2171023T220653ZATaco
024Perl 6171023T204512ZSean
012Dyalog APL171023T200427ZAdalynn
031Haskell171023T200246Zbutterdo
109Racket171023T195022Zsdfbhg
156C++171023T193947ZDylan Tu
006Gaia171023T194646ZMr. Xcod
055SmileBASIC171023T171642Z12Me21
081Eukleides171023T163705Zbrhfl
014Pyth171023T155139ZIan H.
061Batch171023T154620ZNeil
037Python 3171023T154408Zxnor
040JavaScript ES6171023T145045ZArnauld
007MATL171023T152235ZLuis Men
081Swift 3171023T151710ZAnonymou
006Neim171023T151022ZOkx
039PowerShell171023T145740ZAdmBorkB
044Java 8171023T145230ZKevin Cr
031Proton171023T145153Zhyperneu

Tcl, 68 bytes

proc R {a b c} {expr $a[set H ==hypot(]$b,$c)|$b$H$a,$c)|$c$H$a,$b)}

Try it online!

Still too long.

Uiua, 8 bytes

=+°⊟₃⍆°√

Try it!

°√ square each element, ⍆ sort, °⊟₃ untriple the array onto the stack, and check if + adding the first and second elements = equals the third

AWK, 46 bytes

$0=(a=$1^2)+(b=$2^2)==(c=$3^2)||a+c==b||b+c==a

Prints 1 if true, nothing if false.

Attempt This Online!

Swift 6, 65 bytes

let r={{a in a[0]*a[0]+0+a[1]*a[1]==a[2]*a[2]}(($0+[]).sorted())}

r takes an Array of Ints. The array is expected to have exactly three values (less than that and it goes out with a bang, more than that and it goes out with a whimper).

Husk, 7 bytes

Ẋo=+m□O

Try it online!

Takes a list of side lengths and outputs a 1-element list: [1] if true, [0] - otherwise. I have started with a slightly different idea (§=ΣoD▲m□, 8 bytes) but later realized that works on triples too. Commented:

      O # sort the list: put the longest side at the end
    m□  # square every side
Ẋo      # construct a function with 3 arguments that operates on list:
   +    #  sum the 1st and the 2nd elements
  =     #  check whether the result is equal to the 3rd element

Wolfram Language (Mathematica), 18 14 bytes

#.#==2Max@#^2&

Try it online!

Thanks to @att for –4 bytes!

Checks if the sum of the squared numbers is equal to twice the square of the maximum number.

Vyxal, 35 bitsv2, 4.375 bytes

²:∑½c

Try it Online!

Ports Thunno 2

Explained (old)

s²Ṙḣ∑=
s²     # sort and square the input
  Ṙ    # reverse the list so that it's in descending order
   ḣ   # push the head of that, and the rest of that to the stack
    ∑= # does the sum of the list equal the other item? 

Thunno 2, 5 bytes

²DS½Ƈ

Attempt This Online!

Port of DELETE_ME's Jelly answer.

Explanation

²DS½Ƈ  # Implicit input         ->  [5, 3, 4]
²      # Square each value      ->  [25, 9, 16]
 DS    # Duplicate and sum      ->  [25, 9, 16]  50
   ½   # Halve the sum          ->  [25, 9, 16]  25
    Ƈ  # Check for containment  ->  1
       # Implicit output

MS Excel, 48 Bytes

Anonymous worksheet function that takes input from the range [A1:C1] and outputs to the calling cell.

=Let(a,A1^2,b,B1^2,c,C1^2,Or(a+b=c,b+c=a,a+c=b))

Rust, 44 bytes

|n|{n.sort();n[0]*n[0]+n[1]*n[1]==n[2]*n[2]}

Try it online! Takes in an &mut[u64] of at least three elements and proceeds to sort and test if the Pythagorean theorem holds. If sorting floats in rust were easier (it's hard because they can't implement the Ord trait, which is required by the sorting functions) I could use the hypot function and wind up with this:

|n|{n.sort();n[0].hypot(n[1])==n[2]}

which is much shorter.

Templates Considered Harmful, 140 bytes

Fun<Ap<Fun<bor<Eq<Add<A<1>,A<2>>,A<3>>,bor<Eq<Add<A<2>,A<3>>,A<1>>,Eq<Add<A<3>,A<1>>,A<2>>>>>,Mul<A<1>,A<1>>,Mul<A<2>,A<2>>,Mul<A<3>,A<3>>>>

Try it online!

Anonymous function (all TCH functions are anonymous) that takes 3 integers as inputs.

Cool language that uses C++ templates evaluated by a typedef. Interestingly, this is a similar length to the actual C++ answer.


Fun<  //Anonymous function declaration
  Ap< //Apply following function with arguments (a²,b²,c²)
    Fun<
      bor<
        Eq<Add<A<1>,A<2>>,A<3>>,  // (a²+b²=c²)|
        bor<                      //((b²+c²=a²)|
          Eq<Add<A<2>,A<3>>,A<1>>,// (c²+a²=b²))
          Eq<Add<A<3>,A<1>>,A<2>>
        >
      >
    >,
    Mul<A<1>,A<1>>,Mul<A<2>,A<2>>,Mul<A<3>,A<3>> //arguments (a²,b²,c²)
  >
>

GolfScript, 10 bytes

~${.*}/-+!

Try it online!

Takes an array as input and outputs 1 for true and 0 for false.

~$           # Sort the array                  [3 4 5]       [1 2 3]
  {.*}/      # Square all elements             9 16 25       1 4 9
       -     # Subtract the last two numbers   9 -9          1 -5
        +    # Add the numbers left            0             -4
         !   # Negate the answer               1             0

Japt, 8 bytes

m²ø½*Ux²

Try it

Japt -x¡, 7 bytes

˲ѶUx²

Try it

APL NARS 14 chars

{⍵∊⍨√2÷⍨+/⍵*2}

(seen in some other answer) test:

  f←{⍵∊⍨√2÷⍨+/⍵*2}
  f 3 4 5
1
  f 1 1 1
0
  f 5 3 4
1
  f 3 5 4
1
  f 12 37 35
1
  f 21 38 50
0
  f 210 308 250
0

Here ⍵ is the argument of function f.

{⍵∊⍨√2÷⍨+/⍵*2}   
           ⍵*2} if ⍵=1 2 3, ⍵*2 will be 1 4 9 (square the argument ⍵)
         +/     if ⍵*2 is 1 4 9 here sum it 1+4+9=14(sum list)
     √2÷⍨       here makes d=sqrt( (sum list above)/2 )
 ⍵∊⍨            here return 1 if d is element of ⍵, else return 0
                 because ⍨ reverse arguments of its left operator ∊

This follow from this: Given a, b, c the length of one triangle, they are the length of one right triangle <=> a^2+b^2=c^2 and a,b,c different from 0.

  |\
  | \
  |  \ 
 a|   \c
  |    \
  |_____\
     b
  a^2+b^2=c^2 <=> (a^2+b^2+c^2)/2=(2*a^2+2*b^2)/2=a^2+b^2=c^2 <=> 
  <=> (a^2+b^2+c^2)/2 ∊ {a^2, b^2, c^2}

Japt, 7 bytes

øUx²z q

Try it online!

Excel, 47 bytes

Returns FALSE for right-angled Triangles, else TRUE:

=ISERR(FIND(SQRT((A1^2+B1^2+C1^2)/2),A1&B1&C1))

Lua, 90 bytes

t={...}for k,v in pairs(t)do t[k]=tonumber(v)end table.sort(t)print(t[1]^2+t[2]^2==t[3]^2)

Try it online!

JavaScript (Node.js), 45 bytes

(a,b,c)=>[a*=a,b*=b,c*=c].includes((a+b+c)/2)

Try it online!

Half the sum of the squares of the sides should equal the square of the max side. Returns a bool.

The TIO link runs all the tests in a loop.

PHP, 44 bytes

echo($a**2+$b**2+$c**2)/2==max($a,$b,$c)**2;

Try it online!

Half the sum of the squares of the sides should equal the square of the max side. Emits "1" for true and "" (empty string) for false.

The TIO link runs all the tests in a loop.

Perl 5, 34 +2 (-ap) bytes

$x+=($_*=$_)/2for@F;$_=grep/$x/,@F

seems that can be shortened to 29 +2 but there is a warning: smartmatch is experimental

$x+=($_*=$_)/2for@F;$_=$x~~@F

the question i couldn't prove but it works in all tests i've tried is if the number (a^2+b^2+c^2)/2 can be a substring of a number (a^2/2 b^2/2 or c^2/2) which would give a false positive.

Try It Online

Julia 0.6, 14 bytes

L->L'L∈2L.^2

Try it online!

Based @mdahmoune's hint that "The problem is equivalent to whether (a² + b² + c²) ÷ 2 is in {a², b², c²}" - this expresses the condition "(a² + b² + c²) is in {2a², 2b², 2c²}" for a given array L=[a,b,c].

L'L is multiplying the array by itself as a matrix multiplication, so

[a b c]*[a    = a^2 + b^2 + c^2
         b
         c]

L.^2 is elementwise squaring, so is equal to [a^2 b^2 c^2].

is a synonym to in, and checks membership - so the code checks that "sum of squares evaluates to twice of any one of the squares".

Just saw @Dennis' previous Julia answer and saved a few bytes thanks to that. This golf improves on it by two bytes, by using L'L instead of L⋅L (⋅ is a 3-byte Unicode character).

Triangularity,  49  31 bytes

...)...
..IEO..
.M)2s^.
}Re+=..

Try it online!

Explanation

Every Triangularity program must have a triangular padding (excuse the pun). That is, the ith line counting from the bottom of the program must be padded with i - 1 dots (.) on each side. In order to keep the dot-triangles symmetrical and aesthetically pleasant, each line must consist of 2L - 1 characters, where L is the number of lines in the program. Removing the characters that make up for the necessary padding, here is how the code works:

)IEOM)2s^}Re+=     Full program. Input: STDIN, Output: STDOUT, either 1 or 0.
)                  Pushes a zero onto the stack.
 IE                Evaluates the input at that index.
   O               Sorts the ToS (Top of the Stack).
    M)2s^}         Runs the block )2s^ on a separate stack, thus squaring each.
          R        Reverse.
           e       Dump the contents separately onto the stack.
            +      Add the top two items.
             =     Check if their sum is equal to the other entry on the stack (c^2).

Checking if a triangle is right-angled in Triangularity...

J, 10 bytes

-6 bytes thanks to FrownyFrog

=`+/@\:~*:

original answer

(+/@}:={:)@/:~*:

/: sort the squares *:, then check if the sum of the first two +/@}: equals the last {:

Try it online!

Pyt, 12 8 6 bytes

²ĐƩ₂⇹∈

Explanation:

                 implicit input (as a list, i.e., "[A,B,C]")
 ²               square each element in the list
  Đ              duplicate the list (on stack twice)
   Ʃ             sum elements in list on top of stack
    ₂            divide sum by 2
     ⇹           swap top two items on stack
      ∈          check if sum/2 is in the list of squares
                 implicit print

Try it online!

05AB1E, 5 bytes

à‚nOË

Try it online!

JavaScript 6, recursive way, 40 Bytes

f=(a,b,c)=>c<a|c<b?f(b,c,a):a*a+b*b==c*c

f=(a,b,c)=>c<a|c<b?f(b,c,a):a*a+b*b==c*c
console.log(f(4,5,3));
console.log(f(4,5,6));

C (gcc), 42 bytes

f(a,b,c){c=c<a|c<b?f(b,c,a):a*a+b*b==c*c;}

Try it online!

Pyth - 23 22 Bytes, 22 21 if falsy value doesn't need to be the same every time

!-+^@KSQZ2^@K1 2^@K2 2

Try it online!

Returns True or False

or (if falsy value does not need to be the same every time)

-+^@KSQZ2^@K1 2^@K2 2

Try it online!

Returns 0 or a number other than 0

This can probably be golfed a lot

Explanation:

!        Logical negate; Makes 0 true and others false. Not necessary if falsy values can be different 
 -       Subtract
  +      Add
   ^     To the power of
    @    Index in
     K   Assign variable K, returning K
      S  Sorted
       Q Input
     Z   Zero
    2    2
   ^     To the power of
    @    Index in
     K   Variable K
     1   1
    2    2
   ^     To the power of
    @    Index In
     K   Variable K
     2   2
    2    2

Python 2, 37 bytes

a,b,c=sorted(input())
1/(a*a+b*b-c*c)

Try it online!

-2 thanks to FlipTack.
-1 thanks to Craig Gidney.

Outputs via exit code (0 = false, 1 = true).

CJam 10

q~$_.*~-+!

Simplest one I found but also shortest

q reads input as string. Leave input formatted as array [3 4 5]
~ dumps it to stack 
$ sorts array
_ duplicates array
.* multiplies each element by itself
~ dumps array to stack
-+ determines largest minus two smallest numbers
! if 0 return 1 and 0 if anything else

Try it online

Lua, 66 bytes

function f(...)t={...}table.sort(t)print(t[1]^2+t[2]^2==t[3]^2)end

This could be simplified by using table call syntax which would mean that the table does not need to be constructed in the function, saving 9 bytes.

Try it online!

Try it online on tio.run!

Common Lisp, 64 bytes

(apply(lambda(x y z)(=(+(* x x)(* y y))(* z z)))(sort(read)#'<))

Try it online!

As usual in Common Lisp, true is T and false is NIL.

Ohm v2, 8 6 bytes

²DS)Σε

Try it online!

Axiom, 39 bytes

f x==(y:=sort x;y.1^2+y.2^2=y.3^2=>1;0)

f(x) function Input one list of at last 3 numbers

Output 1 (it is right triangle)

Output 0 (it is not right triangle)

Excel VBA, 49 Bytes

Anonymous VBE immediate window function that takes input from range [A1:C1] and output to the VBE immediate window.

[2:2]=[(1:1)^2]:?[Or(A2+B2=C2,B2+C2=A2,A2+C2=B2)]

Triangular, 57 bytes

I haven't seen any in this language yet and it seemed appropriate to try and do one. It took a bit ... as I had to get my head around it first and I believe this could be golfed some more.

,$\:$:*/%*$"`=P:pp.0"*>/>-`:S!>/U+<U"g+..>p`S:U/U"p`!g<>/

Try it online!

This expands to the following triangle.

          ,
         $ \
        : $ :
       * / % *
      $ " ` = P
     : p p . 0 "
    * > / > - ` :
   S ! > / U + < U
  " g + . . > p ` S
 : U / U " p ` ! g <
> /

The path is quite convoluted, but I'll try and explain what I have done. I will skip the directional pointers. Most of the code is stack manipulation.

Pari/GP, 29 24 bytes

f(v)=v~==2*vecmax(v)^2

Try it online!

Saved five bytes by an obvious change from norml2(v) to v*v~.

Inspired by other answers.

Here v must be a row vector or a column vector with three coordinates.

Example of use: f([3,4,5])

Of course, you get rational side lengths for free, for example f([29/6, 10/3, 7/2]).

If I do not count the f(v)= part, that is 19 bytes. The first part can also be written v-> (total 22 bytes).

Explanation: If the three coordinates of v are x, y and z, then the product of v and its transpose v~ gives a scalar x^2+y^2+^z^2, and we need to check if that is equal to twice the square of the maximum of the coordinates x, y, z.

Extra: The same f tests for a Pythagorean quadruple if your input vector has four coordinates, and so on.

MY, 13 bytes

22ω^÷Σ2ω^=Σ𝔹←

Try it online!

This helped me realize ... I screwed up the NOT function (and the boolean conversion function).

How it works (cross-compatible function)

22ω^÷Σ2ω^=Σ𝔹←
2             = push 2 to the stack
 2ω^          = push ω^2 to the stack (functions vectorize)
    ÷         = pop a, then b. push a/b (rational) to the stack
     Σ        = sum
      2ω^=    = equality test with ω^2
          Σ𝔹  = boolean conversion
            ← = output

PHP, 48 47 bytes

sort($a);echo($a[2]**2==$a[1]**2+$a[0]**2)?1:0;

Try it online!

Outputs 1 for true, 0 for false.

Pushy, 10 8 bytes

GK2ek+=#

Try it online!

Managed to cut off two bytes by changing the approach, here's how it works now:

          \ Implicit Input                  eg. [3, 4, 5]
G         \ Sort the stack descendingly         [5, 4, 3]
 K2e      \ Square all items                    [25, 16, 9]
    k+    \ Sum last two                        [25, 25]
      =   \ Check equality (1 or 0)             [1]
       #  \ Output result                       PRINT: 1

Original Version, 10 bytes

gK2eSk2/=#

           \ Input implicitly on stack.              eg. [5, 4, 3]
 g         \ Sort the stack ascendingly.                 [3, 4, 5]
 K2e       \ Square all items.                           [9, 16, 25]
 Sk2/      \ Append stack sum divided by 2               [9, 16, 25, 25]
 =#        \ Print equality of last two items (1/0)      PRINT: 1

Go, 96 94 bytes

package r;import"sort";func I(i...int)bool{sort.Ints(i);return i[0]*i[0]+i[1]*i[1]==i[2]*i[2]}

Test:

import "r"
import "fmt"

func main() {
    fmt.Println(r.I(3, 5, 4))
    fmt.Println(r.I(12, 37, 35))
    fmt.Println(r.I(21, 38, 5))
    fmt.Println(r.I(210, 308, 15))
}

Try it online!

CJam, 9

q~$W%~mh=

Try it online

Explanation:

q~      read and evaluate the input (given as an array)
$W%     sort and reverse the array
~       dump the array on the stack
mh      get the hypotenuse of a right triangle with the given 2 short sides
=       compare with the longer side

TI-Basic, 13 11 10 bytes

max(Ans=R►Pr(min(Ans),median(Ans

Now works for inputs in any order and is shorter as well. Another -1 thanks to @MishaLavrov

Octave, 29 bytes

sum(a=input("").^2)==max(2*a)

Try it online!

Input has to be given in a format octave understands as a vector, like [3 5 4] or [12;35;37].

Checks for Pythagoras's theorem: first, square all the sides, then check if the sum of squares of all the sides is twice the square of the hypotenuse.

Output will be either ans = 1 or ans = 0

Jelly, 5 bytes

²µSHe

Try it online!

Technical note: Bytes are counted in Jelly codepage.

Explanation:

²µSHe  Main link.
²      Square each number.
 µ     With the new list,
  S    calculate its sum,
   H   and halve it.
    e  Check if the result exists in the new list (squared input)

The problem is equivalent to being given three numbers a, b, c, and asking if there is a permutation such that a² + b² = c². This is equivalent to whether (a² + b² + c²) ÷ 2 is one of a², b² or c², so the program just checks that.

Java (OpenJDK 8), 68 bytes

a->{java.util.Arrays.sort(a);return a[0]*a[0]+a[1]*a[1]==a[2]*a[2];}

Try it online!

Jq 1.5, 31 23 bytes

map(.*.)|.[[add/2]]!=[]

Expects input in form of 3 element array, e.g. [5, 3, 4]

Expanded

  map(.*.)           # square each element
| .[[ add/2 ]]!=[]   # true if index of sum/2 element exists

Thanks to mdahmoune for suggesting shorter approach then my original one.

Try it online!


Jq 1.5, 31 bytes

sort|map(.*.)|(.[:2]|add)==.[2]

Expects input in form of 3 element array, e.g. [5, 3, 4]

Expanded

  sort                   # put elements in order
| map(.*.)               # square each element
| (.[:2]|add) == .[2]    # is sum of first two equal to third?

Try it online!

Julia 0.6, 16 bytes

!x=x⋅x∈2x.*x

Try it online!

How it works

Let x = [a, b, c].

x⋅x is the dot product of x and itself, so it yields a² + b² + c².

2x.*x is the element-wise product of 2x and x, so it yields [2a², 2b², 2c²].

Finally, tests if the integer a² + b² + c² belongs to the vector [2a², 2b², 2c²], which is true iff
a² + b² + c² = 2a² or a² + b² + c² = 2b² or a² + b² + c² = 2c², which itself is true iff
b² + c² = a² or a² + c² = b² or a² + b² = c².

GNUOctave, 32 bytes

A=input("")
sum(A.^2)/2==max(A)^2

The input must be like : [1,2,3] so Octave can evaluate it to a Matrix.

A.^2 squares all the elements of the matrix.

Outputs 1 if the triangle is right-angled, 0 otherwise.

You can try it online : https://octave-online.net

Edit (27 bytes): I saw this answer I thought I could find a better solution. I took the idea of squaring the matrix at the beginning. I don't feel like this deserves upvotes since it wasn't really my whole idea to begin with.

A=input("").^2
sum(A)/max(A)

Outputs 2 if the triangle is right-angled and anything else if it isn't.

Stacked, 18 bytes

[sorted:*rev...+=]

Try it online!

Explanation

This is an anonymous function that takes an array of three integers. It sorts (sorted), squares each element of the array (:*), and reverses the array with rev. This will give an array with the largest value in the front. ... pushes each individual member of the array onto the stack, which would make the stack look like:

c^2  b^2  a^2

+ addes the top two members, yielding:

c^2  (b^2+a^2)

= tests for equality. yielding the expression a^2 + b^2 == c^2, which is only true for right triangles.

CJam, 12 11 bytes

This is depressingly long.

{$2f#)\:+=}

Try it online!

Anonymous block that takes input as an array of integers on the stack and returns 1 (truthy) or 0 (falsey).

Explanation:

{      e# Stack:        [12 37 35] 
 $     e# Sort:         [12 35 37]
 2f#   e# Square each:  [144 1225 1369]
 )     e# Pop:          [144 1225] 1369
 \     e# Swap:         1369 [144 1225]
 :+    e# Sum:          1369 1369
 =     e# Equal:        1
}      e# Result: 1 (truthy)

Old solution

{2f#_:+2/#)}

Try it online!

Anonymous block that takes an array of integers on the stack and returns a truthy or falsy integer.

Add++, 25 18 bytes

D,f,?,caaBcB*#s/2=

Try it online!

-7 bytes thanks to mdahmoune

Yes, I got outgolfed in my own language by 7 bytes. So what?

How does it work?

D,f,?,      - Create a variadic function, f. Example arguments: [5 3 4]
      c     - Clear the stack;      STACK = []
      a     - Push the arguments;   STACK = [[5 3 4]]
      a     - Push the arguments;   STACK = [[5 3 4] [5 3 4]]
      Bc    - Push the columns;     STACK = [[5 5] [3 3] [4 4]]
      B*    - Product of each;      STACK = [25 9 16]
      #     - Sort the stack;       STACK = [9 16 25]
      s     - Push the sum;         STACK = [9 16 25 50]
      /     - Divide;               STACK = [9 16 2]
      2     - Push 2;               STACK = [9 16 2 2]
      =     - Equal;                STACK = [9 16 1]

Implicitly return the top element on the stack

Old version

D,f,?,c2 2 2B]a@BcB`#s/2=

The only difference is the squaring of each element (aaBcB* in the golfed version, 2 2 2B]a@BcB` in this version), so I'll quickly explain how this part works

              - Stack is currently empty
2 2 2         - Push 2 three times;             STACK = [2 2 2]
     B]       - Wrap the stack in an array;     STACK = [[2 2 2]]
       a      - Push the arguments as an array; STACK = [[2 2 2] [5 3 4]]
        @     - Reverse the stack;              STACK = [[5 3 4] [2 2 2]]
         Bc   - Push the columns of the stack;  STACK = [[5 2] [3 2] [4 2]]
           B` - Reduce each by exponentiation;  STACK = [25 9 16]

Ruby, 31 bytes

->a{a,b,c=*a.sort;a*a+b*b==c*c}

Takes input as a list of 3 integers. Uses some ideas from other solutions.

Mathematica 39 24 bytes

With 15 bytes saved thanks to Jenny_mathy.

#^2+#2^2==#3^2&@@Sort@#&

Sort ensures that the diagonal will be the third element of z. z[[1]]^2 means

Example

#^2+#2^2==#3^2&@@Sort@#&[{3,5,4}]

 (*True*)

05AB1E, 6 bytes

n{R`+Q

Try it online!

C# (53)

The shortest possible code I could find was the one that looks like the JAVA solution:

(a,b,c)=>{return(a*=a)+(b*=b)==(c*=c)|a+c==b|b+c==a;}

Try it online

Array-input (58)

a=>{Array.Sort(a);return a[0]*a[0]+a[1]*a[1]==a[2]*a[2];};

Dyalog APL, 17 16 bytes

{(+/2÷⍨⍵*2)∊⍵*2}

Try it!

Outputs 1 for true, 0 for false.

Thanks to @Adám for 1 byte.

How it works

{(+/2÷⍨⍵*2)∊⍵*2}          # Anonymous function
 (     ⍵*2)               # Each input (⍵) to the 2nd power
    2÷⍨                   # divided by 2
  +/                      # Sum
           ∊              # "is in"
            ⍵*2           # Each input (⍵) to the 2nd power

This uses the same logic as @user202729's Jelly answer, so some credit goes to them.

Swift 4, 68 bytes

func f(v:inout[Int]){v.sort();print(v[0]*v[0]+v[1]*v[1]==v[2]*v[2])}

Accepts a mutable array as inout argument and prints true or false.

Swift Sandbox.

C,  68  54 bytes

Using user202729's solution.

f(a,b,c){return!((a*=a)+(b*=b)-(c*=c)&&a-b+c&&a-b-c);}

Thanks to @Christoph for golfing 14 bytes!

Try it online!

C, 85 bytes

#define C(a,b,c)if(a*a+b*b==c*c)return 1;
f(a,b,c){C(a,b,c)C(b,c,a)C(c,a,b)return 0;}

Try it online!

C (gcc), 49 bytes

n(a,b,c){return(a*=a)+(b*=b)-(c*=c)&a+c-b&b+c-a;}

Try it online!

Improves on Kevin Cruijssens technique

Returns 0 for a valid triangle, and a non-zero value otherwise

Two answers found by refining the answer by Steadybox and incorporating the technique in the Java answer by Kevin Cruijssen:

C, 52 bytes

f(a,b,c){return(a*=a)+(b*=b)==(c*=c)|b+c==a|c+a==b;}

C, 74 bytes

#define _(a,b,c)a*a+b*b==c*c||
f(a,b,c){return _(a,b,c)_(b,c,a)_(c,a,b)0;}

Test program

#include <stdio.h>
int test(int a, int b, int c, int expected)
{
    int actual = f(a,b,c);
    if (expected != actual) {
        fprintf(stderr, "%d %d %d => %d\n ", a,b,c, actual);
        return 1;
    }
    return 0;
}

int main()
{
    return test(5, 3, 4, 1)
        +  test(3, 5, 4, 1)
        +  test(12, 37, 35, 1)
        +  test(21, 38, 50, 0)
        +  test(210, 308, 250, 0)
        ;
}

APL (Dyalog), 10 bytes

(+/∊×∘2)×⍨

Try it online!

×⍨ square (lit. multiplication selfie)

() apply the following anonymous tacit function on that:

+/ the sum

 is a member of

×∘2 the doubled amounts

Python 2, 43 bytes

lambda a,b,c:(a*a+b*b+c*c)/2in(a*a,b*b,c*c)

Try it online!

Python 2, 79 70 68 62 bytes

lambda*l:any(A*A+B*B==C*C for A,B,C in zip(l,l[1:]+l,l[2:]+l))

Try it online!

Pyth, 11 10 bytes

}/sK^R2Q2K

Try it online!

My first Pyth submission! Explanation:

     R        right map
    ^ 2       squaring
       Q      of the input
   K          save this in K
  s           sum up
 /      2     divide by 2
}        K    test if this sum is in K

saved a byte thanks to Mr. Xcoder

Brain-Flak, 68 bytes

({({({})({}[()])}{}<>)<>})<>({<(({}){}<>[({})])>(){[()](<{}>)}{}<>})

Try it online!

Uses the observation in user202729's answer.

 {                      }      for each input number
   {({})({}[()])}{}            compute the square
  (                <>)<>       push onto second stack
(                        )     push sum of squares onto first stack
                          <>   move to second stack

 {                                    }    for each square
   (({}){}<>[({})])                        compute 2 * this square - sum of squares
  <                >(){[()](<{}>)}{}<>     evaluate loop iteration as 1 iff equal
(                                      )   push 1 if any squares matched, 0 otherwise

R, 31 26 30 bytes

cat(sum(a<-scan()^2)/max(a)==2)

I don't like this one as much, but it is shorter. Sums the squares and divides by the largest square. Truthy if 2.

Previous Version (modified with cat and with @Guiseppe's tip)

cat(!sort(scan())^2%*%c(1,1,-1))

Do a sum of the sorted input with the last item negated and return the ! not.

Try it online!

Racket, 64 60 bytes

(λ(a b c)(=(+(* a a)(* b b)(* c c))(*(expt(max a b c)2)2)))

Try it online!

How it works

Tests if a^2 + b^2 + c^2 is equal to twice the largest of a^2, b^2, and c^2.

Returns #t for right triangles and #f for all other inputs.


RProgN 2, 10 bytes

§²2^r]‘\+e

Explained

§²2^r]‘\+e
§           # Sort the input list
 ²2^r       # Square each element in the list.
     ]      # Duplicate it on the reg stack.
      ‘     # Pop the top (largest) element off it
       \+   # Swap it, sum the rest of the list.
         e  # Are they equal?

Try it online!

Perl 6, 24 bytes

{(*²+*²==*²)(|.sort)}

Try it online!

*²+*²==*² is an anonymous function that returns true if the sum of the squares of its first two arguments is equal to the square of its third argument. We pass the sorted input list to this function, flattening it into the argument list with |.

Dyalog APL, 12 bytes

(+/2÷⍨×⍨)∊×⍨

Uses the same method as this Jelly answer.

Try it online!

Haskell (33 32 31 bytes)

(\x->(sum x)/2`elem`x).map(^2)

Original version:

(\x->2*maximum x==sum x).map(^2)

Anonymous function. Takes a list in the form [a,b,c]. Outputs True or False.

First version checked if the sum of the squares was twice the square of the maximum.

Second, slightly better version checks if half the sum of squares is an element in the list of squares.

Edit: Accidentally counted a newline, thanks H.PWiz

Racket, 109 bytes

#lang racket/base
(define (isright a b c)
  (if (equal? (+ (* a a) (* b b)) (* c c))
      "yes"
      "no"))

Try it online!

C++, 156 bytes

bool f(int*a){int g=[](int*b){return b[0]>b[1]?b[0]>b[2]?0:2:b[1]>b[2]?1:2;}(a);int c[2]={g?0:1,g>1?1:2};return pow(a[c[0]],2)+pow(a[c[1]],2)==pow(a[g],2);}

Gaia, 6 bytes

s¦ΣḥuĖ

Try it online!

SmileBASIC, 55 bytes

DEF R(T)SORT T
RETURN SQR(T[0]*T[0]+T[1]*T[1])==T[2]END

Eukleides, 81 bytes

x=number("")^2;y=number("")^2;z=number("")^2
print x==y+z or y==x+z or z==y+x?1|0

I thought Eukleides would handle this nicely using geometric builtins, but this actually turned out to be longer than just testing against the Pythagorean theorem, because the right triangle assertion is picky about order, and we have to turn our sides into a triangle first:

d e f triangle number(""),number(""),number("")
print right(d,e,f)or right(e,f,d)or right(f,d,e)?1|0

...which is 100 bytes. One nice thing about that one is it'll error out given an impossible triangle. Anyway, for either one, input is via STDIN, output is 1 for right, 0 for non-right via STDOUT. Doing a function was actually longer in this instance.

Pyth, 14 bytes

K_m*ddSQqstKhK

Try it online!

Batch, 61 bytes

@cmd/cset/ax=%1*%1,y=%2*%2,z=%3*%3,!((x+y-z)*(y+z-x)*(z+x-y))

Outputs 1 or 0 appropriately.

Python 3, 37 bytes

lambda*l:sum(x*x/2for x in l)**.5in l

Try it online!

Might run into float precision issues with large inputs.

JavaScript (ES6), 43 41 40 bytes

Saved 1 byte and fixed a bug thanks to @Neil

Takes input as an array of 3 integers. Returns true for right-angled and false otherwise.

a=>a.some(n=>Math.hypot(...a,...a)==n*2)

let f =

a=>a.some(n=>Math.hypot(...a,...a)==n*2)

console.log(f([5, 3, 4     ])) //  --> yes
console.log(f([3, 5, 4     ])) //  --> yes
console.log(f([12, 37, 35  ])) //  --> yes
console.log(f([21, 38, 5   ])) //  --> no
console.log(f([210, 308, 15])) //  --> no


Original version, 44 bytes

Takes input as 3 integers. Returns 1 for right-angled and 0 otherwise.

(a,b,c)=>(a*=a)+(b*=b)==(c*=c)|a+c==b|b+c==a

Test cases

let f =

(a,b,c)=>(a*=a)+(b*=b)==(c*=c)|a+c==b|b+c==a

console.log(f(5, 3, 4     )) //  --> yes
console.log(f(3, 5, 4     )) //  --> yes
console.log(f(12, 37, 35  )) //  --> yes
console.log(f(21, 38, 5   )) //  --> no
console.log(f(210, 308, 15)) //  --> no

MATL, 7 bytes

SU&0)s=

Try it online!

Explanation

Consider input [12, 37, 35].

S     % Implicit input. Sort
      % [12, 35, 37]
U     % Square each entry
      % [144, 1225, 1369]
&0)   % Push last entry and remaining entries
      % STACK: 1369, [144, 1225]
s     % Sum of array
      % STACK: 1369, 1369
=     % Isequal? Implicit display
      % STACK: 1

Swift 3, 81 bytes

func r(v:[Int]){let a=v.sorted{$0<$1};print("\(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])")}

Neim, 6 bytes

ᛦD𝐬ᚺS𝕚

Try it online!

PowerShell, 39 bytes

$a,$b,$c=$args|sort;$a*$a+$b*$b-eq$c*$c

Try it online!

Sorts the input, stores that into $a,$b,$c variables. Then uses Pythagorean theorem to check whether a*a + b*b = c*c. Output is either Boolean True or False.

Java 8, 44 bytes

(a,b,c)->(a*=a)+(b*=b)==(c*=c)|a+c==b|b+c==a

Explanation:

Try it here.

(a,b,c)->                // Method with three integer parameters and boolean return-type
  (a*=a)+(b*=b)==(c*=c)  //  Return if `a*a + b*b == c*c`
  |a+c==b                //  or `a*a + c*c == b*b`
  |b+c==a                //  or `b*b + c*c == a*a`
                         // End of method (implicit / single-line return-statement)

Proton, 31 bytes

k=>(sum(j*j for j:k)/2)**.5in k

Try it online!

Credit to user202729 for the idea go upvote them