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

deleted 155 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, 24 bytes (削除) 24 (削除ここまで) 20 bytes

%33μ3,5¬Tị"¡Ṭ4"Ụp»ȯ
ȷ2RÇ€j75ḍTị"¡Ṭ4"Ụp»ȯμ€G

Try it online! Try it online!

How it works

ȷ2RÇ€j7 3μ3,5ḍTị"¡Ṭ4"Ụp»ȯμ€G Main link. No input.
ȷ23 Yield 100 (1e2).
 R Yield 100.
 μ Range; yield A := [1, ..., 100].
  ǀ Begin a new, monadic chain.
 Apply the helper link to each integer.
 j7 μ€ Apply the preceding chain to all integers Joinn thein results[1, separating by linefeeds.
%3..,5¬Tị"¡Ṭ4"Ụp»ȯ  Helper link100]. Argument: n (integer)

%3,5  Take n A modulo 3 and 5. Yields a,5ḍ pair.
 ¬ Test n Applyfor logicaldivisibility NOTby to3 eachand modulus5.
 This yields 1 for multiples, 0 for non-multiples.
 T T Get all truthy indices.
 This yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3),
 [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị Retrieve the strings at the corr. indices.
 ȯ Logical OR hook; replace an empty arraylist with n.
 G Grid; join the list, separating by linefeeds.

Jelly, 24 bytes

%3,5¬Tị"¡Ṭ4"Ụp»ȯ
ȷ2RÇ€j7

Try it online!

How it works

ȷ2RÇ€j7  Main link. No input.
ȷ2 Yield 100 (1e2).
 R Range; yield A := [1, ..., 100].
  ǀ  Apply the helper link to each integer.
 j7 Join the results, separating by linefeeds.
%3,5¬Tị"¡Ṭ4"Ụp»ȯ  Helper link. Argument: n (integer)

%3,5  Take n A modulo 3 and 5. Yields a pair.
 ¬ Apply logical NOT to each modulus.
 This yields 1 for multiples, 0 for non-multiples.
 T Get all truthy indices.
 This yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3),
 [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị Retrieve the strings at the corr. indices.
 ȯ Logical OR hook; replace an empty array with n.

Jelly, (削除) 24 (削除ここまで) 20 bytes

3μ3,5ḍTị"¡Ṭ4"Ụp»ȯμ€G

Try it online!

How it works

3μ3,5ḍTị"¡Ṭ4"Ụp»ȯμ€G Main link. No input.
3 Yield 100.
 μ Begin a new, monadic chain.
 μ€ Apply the preceding chain to all integers n in [1, ..., 100].
 3,5ḍ Test n for divisibility by 3 and 5.
 T Get all truthy indices.
 This yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3),
 [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị Retrieve the strings at the corr. indices.
 ȯ Logical OR hook; replace an empty list with n.
 G Grid; join the list, separating by linefeeds.
deleted 93 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, 24 bytes

ȷ2Rμ%3ドル%3,5¬Oị"¡Ṭ4"Ụp»o"j75¬Tị"¡Ṭ4"Ụp»ȯ
ȷ2RÇ€j7

Try it online! Try it online!

How it works

ȷ2Rμ%3,5ドル¬Oị"¡Ṭ4"Ụp»o"j7ȷ2RÇ€j7  Main link. No input.
ȷ2 Yield 100 (1e2).
 R Range; yield A := [1, ..., 100].
 μÇ€ Apply the helper link to each integer.
 Begin a new,j7 monadic chain. Argument: A
 %3ドル Join the results,5 separating by linefeeds.
%3,5¬Tị"¡Ṭ4"Ụp»ȯ Helper link. Argument: n (integer)
%3,5 Take each n in Take n A modulo 3 and 5. Yields a list of pairspair.
 ¬ Apply logical NOT to each modulus.
 This yields 1 for multiples, 0 for non-multiples.
 O T Get all indices oftruthy 1'sindices.
 For a given n, thisThis yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3),
 (mult. of 5, not 3), [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị For each n, retrieveRetrieve the strings at the corr. indices.
 o"  ȯ Logical OR hook; replace an empty array with the corr. n.
 j7 Join, separating by linefeeds.

Jelly, 24 bytes

ȷ2Rμ%3ドル,5¬Oị"¡Ṭ4"Ụp»o"j7

Try it online!

How it works

ȷ2Rμ%3,5ドル¬Oị"¡Ṭ4"Ụp»o"j7 Main link. No input.
ȷ2 Yield 100 (1e2).
 R Range; yield A := [1, ..., 100].
 μ Begin a new, monadic chain. Argument: A
 %3ドル,5 Take each n in A modulo 3 and 5. Yields a list of pairs.
 ¬ Apply logical NOT to each modulus.
 This yields 1 for multiples, 0 for non-multiples.
 O  Get all indices of 1's.
 For a given n, this yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3), [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị For each n, retrieve the strings at the corr. indices.
 o"  Logical OR hook; replace an empty array with the corr. n.
 j7 Join, separating by linefeeds.

Jelly, 24 bytes

%3,5¬Tị"¡Ṭ4"Ụp»ȯ
ȷ2RÇ€j7

Try it online!

How it works

ȷ2RÇ€j7  Main link. No input.
ȷ2 Yield 100 (1e2).
 R Range; yield A := [1, ..., 100].
 ǀ Apply the helper link to each integer.
 j7  Join the results, separating by linefeeds.
%3,5¬Tị"¡Ṭ4"Ụp»ȯ Helper link. Argument: n (integer)
%3,5 Take n A modulo 3 and 5. Yields a pair.
 ¬ Apply logical NOT to each modulus.
 This yields 1 for multiples, 0 for non-multiples.
 T Get all truthy indices.
 This yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3),
 [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị Retrieve the strings at the corr. indices.
 ȯ Logical OR hook; replace an empty array with n.
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, 24 bytes

ȷ2Rμ%3,5ドル¬Oị"¡Ṭ4"Ụp»o"j7

Try it online!

How it works

ȷ2Rμ%3,5ドル¬Oị"¡Ṭ4"Ụp»o"j7 Main link. No input.
ȷ2 Yield 100 (1e2).
 R Range; yield A := [1, ..., 100].
 μ Begin a new, monadic chain. Argument: A
 %3,5ドル Take each n in A modulo 3 and 5. Yields a list of pairs.
 ¬ Apply logical NOT to each modulus.
 This yields 1 for multiples, 0 for non-multiples.
 O Get all indices of 1's.
 For a given n, this yields [1] (mult. of 3, not 5), [2]
 (mult. of 5, not 3), [1, 2] (mult. of 15) or [].
 "¡Ṭ4"Ụp» Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
 ị For each n, retrieve the strings at the corr. indices.
 o" Logical OR hook; replace an empty array with the corr. n.
 j7 Join, separating by linefeeds.

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