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

added 486 characters in body
Source Link
Popov
  • 199
  • 1
  • 3

APL, 52 chars/bytes

generate integers from 1 to n

{c←∨⌿b←0=3

b is a 2 by n boolean matrix highlighting multiples of 3 and 5

b←0=3 5∘.|⍵⋄↑|⍵

c is a boolean vector highlighting multiples of either 3 or 5

c←∨⌿b

format each integer into a character vector

⍕ ̈⍵

where a number is a multiple of either 3 or 5...

@{c}

...put either Fizz or Buzz (i.e. discard the last 4, the first 4 or no character at all from the string "FizzBuzz" according to b)

(↓∘'FizzBuzz' ̈ ̄4 ×ばつc/b)@{c}⍕ ̈⍵}⍳

transform the nested vector into a matrix


APL, 52 chars/bytes

{c←∨⌿b←0=3 5∘.|⍵⋄↑(↓∘'FizzBuzz' ̈ ̄4 ×ばつc/b)@{c}⍕ ̈⍵}⍳

APL, 52 chars/bytes

generate integers from 1 to n

b is a 2 by n boolean matrix highlighting multiples of 3 and 5

b←0=3 5∘.|⍵

c is a boolean vector highlighting multiples of either 3 or 5

c←∨⌿b

format each integer into a character vector

⍕ ̈⍵

where a number is a multiple of either 3 or 5...

@{c}

...put either Fizz or Buzz (i.e. discard the last 4, the first 4 or no character at all from the string "FizzBuzz" according to b)

(↓∘'FizzBuzz' ̈ ̄4 ×ばつc/b)

transform the nested vector into a matrix


Source Link
Popov
  • 199
  • 1
  • 3

APL, 52 chars/bytes

{c←∨⌿b←0=3 5∘.|⍵⋄↑(↓∘'FizzBuzz' ̈ ̄4 ×ばつc/b)@{c}⍕ ̈⍵}⍳

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