13 lines
450 B
Plaintext
13 lines
450 B
Plaintext
# project euler 91
|
|
50
|
|
⍜-⇡0+1 # 0, 1, ... 50
|
|
♭˙⊞ℂ # int coords as complex nums
|
|
⧅>2↘1 # without (0, 0), take 2 coords
|
|
/( # vv for each coord pair vv
|
|
⊟₃◡- # - make tuple (P, Q, P-Q)
|
|
+∩°√°ℂ # - calculate P^2, Q^2, (P-Q)^2
|
|
⟜(+⊸↻1) # - sum all combinations
|
|
/↥=↻¯1 # - sum equal to other coord sq len?
|
|
)⍉ # ^^ for each coord pair ^^
|
|
⧻⊚ # count such coord pairs
|