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
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Arturo, (削除) 57 (削除ここまで) 54(削除) 57 54 (削除ここまで) 50 bytes

$->n[map^2n'x->map^2n=>[1<>∑digits.base:2and&>map^2n=>[0<>^and dec<=<=and&-1x-1]]

Try it! Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 1<>0<> ; is onezero not equal to
 and&-1x-1 ; bitwise and of current elts minus one
  <=<=  ; sumduplicated oftwice
 digits.base:2dec ; binary digits of ; minus one
 and&-1x-1and  ; bitwise and of current elts minus one ^ ; NOS to the TOS power
 ] ; end map
] ; end function

Arturo, (削除) 57 (削除ここまで) 54 bytes

$->n[map^2n'x->map^2n=>[1<>∑digits.base:2and&-1x-1]]

Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 1<> ; is one not equal to
  ; sum of
 digits.base:2 ; binary digits of
 and&-1x-1 ; bitwise and of current elts minus one
 ] ; end map
] ; end function

Arturo, (削除) 57 54 (削除ここまで) 50 bytes

$->n[map^2n'x->map^2n=>[0<>^and dec<=<=and&-1x-1]]

Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 0<> ; is zero not equal to
 and&-1x-1 ; bitwise and of current elts minus one
  <=<=  ; duplicated twice
 dec  ; minus one
 and  ; bitwise and  ^ ; NOS to the TOS power
 ] ; end map
] ; end function
-3 bytes
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Arturo, 57(削除) 57 (削除ここまで) 54 bytes

$->n[map^2n'x->map^2n=>[1<>size--as>map^2n=>[1<>∑digits.binary and&base:2and&-1x-1{0}]]1]]

Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 1<> ; is one not equal to
 size  ; the lengthsum of
 --  digits.base:2 ; setbinary differencedigits betweenof
 as.binary and&-1x-1 ; bitwise and of current elts minus one in binary
 {0} ; and the string "0"
 ] ; end map
] ; end function

Arturo, 57 bytes

$->n[map^2n'x->map^2n=>[1<>size--as.binary and&-1x-1{0}]]

Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 1<> ; is one not equal to
 size  ; the length of
 --  ; set difference between
 as.binary and&-1x-1 ; bitwise and of current elts minus one in binary
 {0} ; and the string "0"
 ] ; end map
] ; end function

Arturo, (削除) 57 (削除ここまで) 54 bytes

$->n[map^2n'x->map^2n=>[1<>∑digits.base:2and&-1x-1]]

Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 1<> ; is one not equal to
  ; sum of
 digits.base:2 ; binary digits of
 and&-1x-1 ; bitwise and of current elts minus one
 ] ; end map
] ; end function
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Arturo, 57 bytes

$->n[map^2n'x->map^2n=>[1<>size--as.binary and&-1x-1{0}]]

Try it!

$->n[ ; a function taking an argument n
 map^2n'x-> ; map over [1..2^n]; assign current elt to x
 map^2n=>[ ; map over [1..2^n]; assign current elt to &
 1<> ; is one not equal to
 size ; the length of
 -- ; set difference between
 as.binary and&-1x-1 ; bitwise and of current elts minus one in binary
 {0} ; and the string "0"
 ] ; end map
] ; end function

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