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

Return to Answer

-4 bytes thanks to @xnor's suggestion to use expt.
Source Link
Misha Lavrov
  • 5.3k
  • 14
  • 27

Racket, 64(削除) 64 (削除ここまで) 60 bytes

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

Try it online! 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.


  • -4 bytes thanks to @xnor's suggestion to use expt.

Racket, 64 bytes

(λ(a b c)(=(+(* a a)(* b b)(* c c))(*(max a b c)(max a b c)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.

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.


  • -4 bytes thanks to @xnor's suggestion to use expt.
added 67 characters in body
Source Link
Misha Lavrov
  • 5.3k
  • 14
  • 27

Racket, 64 bytes

(λ(a b c)(=(+(* a a)(* b b)(* c c))(*(max a b c)(max a b c)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.

Racket, 64 bytes

(λ(a b c)(=(+(* a a)(* b b)(* c c))(*(max a b c)(max a b c)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.

Racket, 64 bytes

(λ(a b c)(=(+(* a a)(* b b)(* c c))(*(max a b c)(max a b c)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.

Source Link
Misha Lavrov
  • 5.3k
  • 14
  • 27

Racket, 64 bytes

(λ(a b c)(=(+(* a a)(* b b)(* c c))(*(max a b c)(max a b c)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.

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