New answers tagged

1 vote

FizzFizzFizzBuzz!

sed 4.2.2 + coreutils factor, 65 bytes s/^/factor /e s/ 3\b/Fizz/g s/ 5\b/Buzz/g /z/s/[0-9 :]//g s/:.*// Try it online!
Digital Trauma's user avatar
0 votes

FizzFizzFizzBuzz!

Perl 5, 60 bytes @x[++$q*3,$q*5]=(Fizz.$_,$_.Buzz),print$_||$q,$/for@x[1..<>] Try it online!
Sisyphus's user avatar
  • 14.8k
0 votes

FizzFizzFizzBuzz!

PowerShell, 120 bytes function FizzBuzz($N){1..$N|%{$i=$_;for($j=$i;$j%3-eq0;$j/=3){'Fizz'};for(;($j%5)-eq0;$j/=5){'Buzz'};if($i-$j-eq0){$_}}} Try it online!
Mark Harwood's user avatar
0 votes

Converting Strings to Decimals (Gone Wrong)

JavaScript (Node.js), 41 bytes f=s=>s[0]?Buffer(s.pop())[0]-48+f(s)*10:0 Try it online! Takes input as an array of characters.
Justin Mariner's user avatar
0 votes

Converting Strings to Decimals (Gone Wrong)

Pip, 9 bytes A*a-48FDt Try It Online! Explanation ...
DLosc's user avatar
  • 39.4k
1 vote

FizzFizzFizzBuzz!

Python 3, 157 bytes This is my best go without looking at the other solutions. Thanks to @SectorCorrupter for their tip on using * for string manipulation. My ...
cnln's user avatar
  • 51
1 vote

Sum the powers that be

Uiua 0.11.0, 14 bytes SBCS /+▽=0:⟜◿ⁿ:+1⇡, Try on Uiua Pad! Takes k and n and returns the ...
Tbw's user avatar
  • 1,815
1 vote

FizzFizzFizzBuzz!

C# (Hussy.Net), 92 bytes Gr(N).E(i=>{string e = null;F(i,Dvb3,Dv3,_=>e+="Fizz");F(i,Dvb5,Dv5,_=>e+="Buzz");W(e,i);}); Explanation <...
Hazel へいぜる's user avatar
1 vote

FizzFizzFizzBuzz!

JavaScript (Node.js), 143 bytes ...
2pichar's user avatar
  • 221
1 vote

FizzFizzFizzBuzz!

Perl 5, 76 bytes sub c{$_%$_[0]?0:($_/=$_[0],1+&c)}say'Fizz'x c(5).'Buzz'x c(3)||$_ for 1..<> Try it online! (I was tempted to post ...
Martin Kealey's user avatar
1 vote

FizzFizzFizzBuzz!

Ruby, 85 bytes ->n{(1..n).map{|x|a,b=[3,5].map{|d|x.to_s(d)[/0*$/].size};a+b>0?"Fizz"*a+"Buzz"*b:x}} Try it online!
G B's user avatar
  • 21.9k
2 votes

FizzFizzFizzBuzz!

Haskell, 109 bytes ...
totallyhuman's user avatar
  • 17.2k
2 votes

FizzFizzFizzBuzz!

Perl 5, 75 bytes map{$r='';$_/=3,$r.=Fizz until$_%3;$_/=5,$r.=Buzz until$_%5;say$r||$_}1..<> Try it online!
Xcali's user avatar
  • 14.9k
3 votes

FizzFizzFizzBuzz!

Uiua 0.10.3, 42 bytes SBCS ∵(&p◌⍥:±⧻.♭▽:"Fizz"_"Buzz"/+⍉⊞=3_5°/×.)+1⇡ Explanation ...
Tbw's user avatar
  • 1,815
2 votes

FizzFizzFizzBuzz!

OCaml, 236 235 bytes ...
sporkl's user avatar
  • 6,864
3 votes

FizzFizzFizzBuzz!

Retina 0.8.2, 87 bytes .+ $*¶ $.` 1A` %(`.+ $* +`^(\D*(1+))\2{4}$ Buz$1 +`^(\D*(1+))\2\2$ Fiz$1 z1* zz 1+ $.& Try it online! Explanation: ...
Neil's user avatar
  • 170k
4 votes

FizzFizzFizzBuzz!

Jelly, 18 bytes ọ3,5“¡Ṭ4“Ụp»ẋ"Fȯ)Y A full program that accepts a positive integer and prints the FizzFizzFizzBuzz sequence. Try it online! How? ...
Jonathan Allan's user avatar
4 votes

FizzFizzFizzBuzz!

In my solutions, the function is found verbatim in the full program. C (gcc), 137 114 bytes (just function) ...
virolino's user avatar
  • 141
6 votes

FizzFizzFizzBuzz!

R 4.1 and above, 108 97 92 bytes 5 bytes down thanks to giuseppe. ...
Martin Modrák's user avatar
2 votes

FizzFizzFizzBuzz!

Charcoal, 31 bytes EN∨ΣE⪪FiBu²×⁺λzz⌕X⁰⮌↨⊕ι⁺³⊗μ⁰I⊕ι Try it online! Link is to verbose version of code. Explanation: ...
Neil's user avatar
  • 170k
3 votes

FizzFizzFizzBuzz!

APL+WIN, 79 76 bytes. Multi-line function shorter than one liner Prompts for integer n n←⎕ :for i :in ⍳n ((0=⍴t)↑i),t←∊(∊+/0=1|i÷(⊂3 5)*¨⍳⌈i*.5)/'Fizz' 'Buzz' :end ...
Graham's user avatar
  • 6,106
5 votes

FizzFizzFizzBuzz!

sed -E, 87 84 bytes This one takes the number of input lines for the number of lines to output. It outputs numbers as unary (if not Fizz or Buzz): ...
Philippos's user avatar
  • 2,501
4 votes

FizzFizzFizzBuzz!

05AB1E, 27 26 bytes ENDÓ0Þ«2Lè”FizzÒÖ”#×JD?`þ, Try it online. Explanation: ...
Kevin Cruijssen's user avatar
7 votes

FizzFizzFizzBuzz!

Python 3, 95 bytes f=lambda n:n and[f(n-1),print(g(n,3)*'Fizz'+g(n,5)*'Buzz'or n)] g=lambda i,d:i%d<1and-~g(i/d,d) Try it online! -1 byte thanks to Mukundan314 ...
Jitse's user avatar
  • 7,016
7 votes

FizzFizzFizzBuzz!

JavaScript, 81 78 74 bytes -4 bytes thanks to myself... -3 bytes thanks to Arnauld. ...
Matthew Jensen's user avatar
10 votes

FizzFizzFizzBuzz!

Vyxal j, 74 bitsv2, 9.25 bytes ƛ35fǑkF½*∑∴ Try it Online! Bitstring: ...
lyxal's user avatar
  • 33.3k
1 vote

As Easy as One-Two-Three

Pip, 8 bytes ^a=@a+,3 Attempt This Online! Explanation ...
DLosc's user avatar
  • 39.4k
1 vote

As Easy as One-Two-Three

JavaScript (Node.js), 17 bytes n=>n==n[0]*111+12 Try it online!
l4m2's user avatar
  • 23.9k
1 vote

As Easy as One-Two-Three

Scratch, 70 69 bytes A simple question - a simple answer. 1 byte has been golfed away following the kind suggestion of Dlosc. Pseudocode: ...
Patric's user avatar
  • 129
2 votes

Emulate Jelly's tie-scan

tinylisp 2, 78 bytes (d G(\(A D N)(c A(? N(G((h D)A(h N))(,(t D)(] 1 D))(t N))( (\(D N)(G(h N)D(t N The first line defines a helper function ...
DLosc's user avatar
  • 39.4k
3 votes

Emulate Jelly's tie-scan

R, 56 55 bytes \(L,v)Reduce(\(x,y){L<<-c(L[-1],`?`<-el(L));x?y},v,,,T) Attempt This Online! Test harness borrowed from pajonk's answer; -1 byte thanks to ...
Giuseppe's user avatar
  • 28.6k
3 votes

Emulate Jelly's tie-scan

Ruby, 47 44 bytes ->o,l{k=1;l.map{|x|l=l*0!=0?x:o[k^=1][l,x]}} Try it online!
G B's user avatar
  • 21.9k
2 votes

Emulate Jelly's tie-scan

Pip -x, 16 bytes FibYPy?(a@Uvyi)i Takes the list of functions and the list of integers as command-line arguments. Attempt This ...
DLosc's user avatar
  • 39.4k
3 votes

Emulate Jelly's tie-scan

Haskell + hgl, 20 bytes cr<<<lz(m<U id)<<zcz Attempt This Online! Explanation zcz zips the lists together ...
Wheat Wizard's user avatar
  • 98.6k
4 votes

Emulate Jelly's tie-scan

R, 69 bytes \(L,v,k=v[1])for(i in c(v[-1],1))k=L[[F<-F%%length(L)+1]](print(k),i) Attempt This Online!
pajonk's user avatar
  • 16k
5 votes

Emulate Jelly's tie-scan

05AB1E, 8 bytes (could have been 7 bytes, but there is a bug in the cumulative reduce-by builtins) Å»I¾è.V¼ 05AB1E lacks functions, but it can evaluate strings to ...
Kevin Cruijssen's user avatar
5 votes

Emulate Jelly's tie-scan

Haskell, 40 bytes (f:g)#(l:m:n)=l:(g++[f])#(f l m:n) _#l=l Try it online! More functional approach, 51 46 bytes ...
totallyhuman's user avatar
  • 17.2k
5 votes

Emulate Jelly's tie-scan

Wolfram Language (Mathematica), 39 36 bytes -1 from totallyhuman FoldList[h=#;Last[h=##2|#&@@h]@##&]& Try it online! Input ...
att's user avatar
  • 20.4k
4 votes

Emulate Jelly's tie-scan

PowerShell Core, 65 bytes param($n,$o)$n|%{if($p){$p=&$o[$i++%$o.count]$p $_}else{$p=$_}$p} Try it online!
Julian's user avatar
  • 3,038
4 votes

Emulate Jelly's tie-scan

Vyxal Wr, 61 bitsv2, 7.625 bytes ¨Sḣ(:n?† Try it Online! Bitstring: ...
lyxal's user avatar
  • 33.3k
7 votes

Emulate Jelly's tie-scan

Python 3.8, 55 bytes lambda o,x,*v:[x]+[x:=a(x,n)for a,n in zip(o*len(v),v)] An unnamed function that accepts a list of functions and some values and returns the ...
Jonathan Allan's user avatar
4 votes

Emulate Jelly's tie-scan

JavaScript (Node.js), 46 bytes a=>b=>b.map((c,i)=>h=i--?a[i%a.length](h,c):c) Try it online!
l4m2's user avatar
  • 23.9k
4 votes

X Steps Forward, 1 Step Back

Vyxal, 6 bytes ½ɾ∑:∷+ Try it Online! Now flagless, thanks to emanresu A's suggestion. This ties with their solution, though this is less clever. I just like the <...
noodle man's user avatar
  • 6,903
4 votes

X Steps Forward, 1 Step Back

PowerShell Core, 26 bytes 0 for(){($c+=++$i) (--$c)} Try it online! Output the sequence indefinitely
Julian's user avatar
  • 3,038
4 votes

X Steps Forward, 1 Step Back

Vyxal, 6 bytes Þnuv∴¦ Try it Online! Outputs an infinite list. ...
emanresu A's user avatar
  • 37.8k
4 votes

X Steps Forward, 1 Step Back

Uiua, 10 bytes +◿2./+⇡⌊÷2 Try it Based on Shaggy's Japt. Explanation: ⌊÷2 Floor divide by 2 ...
noodle man's user avatar
  • 6,903
1 vote

Emoticon numbers!

Pip, \$\approx 1.001001\times10^{3999}\$ mXm Attempt This Online! m is a variable preinitialized to ...
DLosc's user avatar
  • 39.4k
5 votes

Break an integer into even- and odd-indexed bits

x86 machine code, 18 bytes ...
corvus_192's user avatar
  • 5,097
3 votes

Break an integer into even- and odd-indexed bits

Uiua 0.10.0, 22 bytes ↙2▽2⍜⌵(⊕°⋯◿2⇡⧻.⊂⋯):<0. Explanation + See it in action
RomanPro100's user avatar
0 votes

Is it a tetrate of two?

Easyfuck, 37 33 bytes D‘ňŰo␐SHY[­HOPC␅iě)V®ßÜ -°Obę—ĘŢ]|‘‚ŰNBSP due to lack of unicode representations for c1 control characters, they have been replaced by their superscripted abbreviations ...
Quadruplay's user avatar

Top 50 recent answers are included