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

Wrote up an explanation
Source Link
Nitrodon
  • 10.8k
  • 2
  • 20
  • 36

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

Brain-Flak, 68 bytes

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

Try it online!

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
Source Link
Nitrodon
  • 10.8k
  • 2
  • 20
  • 36

Brain-Flak, 68 bytes

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

Try it online!

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