APL (Dyalog Unicode), (削除) 73 (削除ここまで) 6967 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+e×ばつ⍨⍳⍵⋄0= ̄2⊥+/w=e×ばつ,w=e×ばつ⍪(⍉↓r∘.+r∘r∘.×ばつ32+⍨32 8×ばつr)×ばつe×ばつ⍨⍳w}
-46 bytes thanks to @ngn and @H.PWiz.
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 69 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(⍉↓r∘.+r∘.×ばつ32 8)×ばつe×ばつ⍨⍳w}
-4 bytes thanks to @ngn and @H.PWiz.
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 67 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥+/w=e×ばつ⍪(r∘.+⍨32 ×ばつr)×ばつe×ばつ⍨⍳w}
-6 bytes thanks to @ngn and @H.PWiz.
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 7169 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(×ばつ32 8)×ばつe×ばつ⍨⍳w}
-24 bytes thanks to @ngn and @H.PWiz.
f←{
⍝ Extract squarefree part of ⍵
×ばつ⍨⍳⍵
⍝ ×ばつ⍨⍳⍵ ⍝ Square of 1..⍵
⍝ ⍵|⍨ ⍝ Remainders of dividing ⍵ by each of the above
⍝ ⊃⌽⍒ ⍝ Last item of descending sort order; index of last 0
⍝ ×ばつ⍨ ⍝ Remove square term and name it w
⍝ 1 if odd, 2 if even; divide w by that
w÷←e←2-2|ww÷←e←2∨w
⍝ e←2-2|we←2∨w ⍝ 2GCD minusof w modulowith 2; name it e
⍝ w÷← ⍝ Divide w by e and overwrite to w
⍝ Square of plus-minus range
×ばつ⍨⍳w
⍝ ×ばつ⍨⍳w ⍝ Square of 1..w
⍝ r←0,2/ ⍝ Make two copies of each number, prepend 0 and name it r
⍝ y2+32z2 (A/C) and y2+8z2 (B/D), with y and z swapped
m←∘.(32 8⊥ ̈∘⊂,)⍨r
⍝ ∘.( )⍨r ⍝ Self outer product of r by...
⍝ , ⍝ Concatenate two input numbers and
32 8⊥ ̈∘⊂ ⍝ Interpret as base-32 and base-8
⍝ m← ⍝ Name it m
⍝ Add ×ばつe×ばつx2
×ばつe×ばつr
⍝ ×ばつe×ばつr ⍝ Outer product by + with ×ばつe×ばつx2
⍝ m←, ⍝ Flatten and overwrite m
⍝ count w in m and check if B/D is twice A/C
0= ̄2⊥⊃+/w=m
⍝ w=m ⍝ Test for each sum being w
⍝ ⊃+/ ⍝ Count of 'w's in A/C and B/D
⍝ ̄2⊥ ⍝ ( ×ばつA/C) + B/D
⍝ 0= ⍝ Equals 0?
}
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 71 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(×ばつ32 8)×ばつe×ばつ⍨⍳w}
-2 bytes thanks to @ngn.
f←{
⍝ Extract squarefree part of ⍵
×ばつ⍨⍳⍵
⍝ ×ばつ⍨⍳⍵ ⍝ Square of 1..⍵
⍝ ⍵|⍨ ⍝ Remainders of dividing ⍵ by each of the above
⍝ ⊃⌽⍒ ⍝ Last item of descending sort order; index of last 0
⍝ ×ばつ⍨ ⍝ Remove square term and name it w
⍝ 1 if odd, 2 if even; divide w by that
w÷←e←2-2|w
⍝ e←2-2|w ⍝ 2 minus w modulo 2; name it e
⍝ w÷← ⍝ Divide w by e and overwrite to w
⍝ Square of plus-minus range
×ばつ⍨⍳w
⍝ ×ばつ⍨⍳w ⍝ Square of 1..w
⍝ r←0,2/ ⍝ Make two copies of each number, prepend 0 and name it r
⍝ y2+32z2 (A/C) and y2+8z2 (B/D), with y and z swapped
m←∘.(32 8⊥ ̈∘⊂,)⍨r
⍝ ∘.( )⍨r ⍝ Self outer product of r by...
⍝ , ⍝ Concatenate two input numbers and
32 8⊥ ̈∘⊂ ⍝ Interpret as base-32 and base-8
⍝ m← ⍝ Name it m
⍝ Add ×ばつe×ばつx2
×ばつe×ばつr
⍝ ×ばつe×ばつr ⍝ Outer product by + with ×ばつe×ばつx2
⍝ m←, ⍝ Flatten and overwrite m
⍝ count w in m and check if B/D is twice A/C
0= ̄2⊥⊃+/w=m
⍝ w=m ⍝ Test for each sum being w
⍝ ⊃+/ ⍝ Count of 'w's in A/C and B/D
⍝ ̄2⊥ ⍝ ( ×ばつA/C) + B/D
⍝ 0= ⍝ Equals 0?
}
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 69 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(×ばつ32 8)×ばつe×ばつ⍨⍳w}
-4 bytes thanks to @ngn and @H.PWiz.
f←{
⍝ Extract squarefree part of ⍵
×ばつ⍨⍳⍵
⍝ ×ばつ⍨⍳⍵ ⍝ Square of 1..⍵
⍝ ⍵|⍨ ⍝ Remainders of dividing ⍵ by each of the above
⍝ ⊃⌽⍒ ⍝ Last item of descending sort order; index of last 0
⍝ ×ばつ⍨ ⍝ Remove square term and name it w
⍝ 1 if odd, 2 if even; divide w by that
w÷←e←2∨w
⍝ e←2∨w ⍝ GCD of w with 2; name it e
⍝ w÷← ⍝ Divide w by e and overwrite to w
⍝ Square of plus-minus range
×ばつ⍨⍳w
⍝ ×ばつ⍨⍳w ⍝ Square of 1..w
⍝ r←0,2/ ⍝ Make two copies of each number, prepend 0 and name it r
⍝ y2+32z2 (A/C) and y2+8z2 (B/D), with y and z swapped
m←∘.(32 8⊥ ̈∘⊂,)⍨r
⍝ ∘.( )⍨r ⍝ Self outer product of r by...
⍝ , ⍝ Concatenate two input numbers and
32 8⊥ ̈∘⊂ ⍝ Interpret as base-32 and base-8
⍝ m← ⍝ Name it m
⍝ Add ×ばつe×ばつx2
×ばつe×ばつr
⍝ ×ばつe×ばつr ⍝ Outer product by + with ×ばつe×ばつx2
⍝ m←, ⍝ Flatten and overwrite m
⍝ count w in m and check if B/D is twice A/C
0= ̄2⊥⊃+/w=m
⍝ w=m ⍝ Test for each sum being w
⍝ ⊃+/ ⍝ Count of 'w's in A/C and B/D
⍝ ̄2⊥ ⍝ ( ×ばつA/C) + B/D
⍝ 0= ⍝ Equals 0?
}
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 7271 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(∘⍉↓r∘.(32×ばつ32 8⊥ ̈∘⊂,)⍨r8)×ばつe×ばつ⍨⍳w}
-1 byte2 bytes thanks to @ngn.
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 72 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(∘.(32 8⊥ ̈∘⊂,)⍨r)×ばつe×ばつ⍨⍳w}
-1 byte thanks to @ngn.
APL (Dyalog Unicode), (削除) 73 (削除ここまで) 71 bytes
{e×ばつ⍨⍳⍵⋄0= ̄2⊥⊃+/w=e×ばつ,(⍉↓r∘.×ばつ32 8)×ばつe×ばつ⍨⍳w}
-2 bytes thanks to @ngn.